remove npins, add nix formatter, bump to jhovold 6.11-rc6

This commit is contained in:
steveej 2024-09-05 22:09:47 +02:00
parent 1c72da4c69
commit 99a7228961
8 changed files with 56 additions and 140 deletions

38
flake.lock generated
View file

@ -5,11 +5,11 @@
"nixpkgs-lib": "nixpkgs-lib"
},
"locked": {
"lastModified": 1719994518,
"narHash": "sha256-pQMhCCHyQGRzdfAkdJ4cIWiw+JNuWsTX7f0ZYSyz0VY=",
"lastModified": 1725234343,
"narHash": "sha256-+ebgonl3NbiKD2UD0x4BszCZQ6sTfL4xioaM49o5B3Y=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "9227223f6d922fee3c7b190b2cc238a99527bbb7",
"rev": "567b938d64d4b4112ee253b9274472dc3a346eb6",
"type": "github"
},
"original": {
@ -18,13 +18,30 @@
"type": "github"
}
},
"linux-jhovold": {
"flake": false,
"locked": {
"lastModified": 1725261528,
"narHash": "sha256-p2rP8fErEnrlrkl2l4ZfnWOG2U/ohAC9blx+sTpU4+I=",
"owner": "jhovold",
"repo": "linux",
"rev": "2997053728cd0675469399212061423e63b48c1f",
"type": "github"
},
"original": {
"owner": "jhovold",
"ref": "wip/sc8280xp-6.11-rc6",
"repo": "linux",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1722062969,
"narHash": "sha256-QOS0ykELUmPbrrUGmegAUlpmUFznDQeR4q7rFhl8eQg=",
"lastModified": 1725432240,
"narHash": "sha256-+yj+xgsfZaErbfYM3T+QvEE2hU7UuE+Jf0fJCJ8uPS0=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "b73c2221a46c13557b1b3be9c2070cc42cf01eb3",
"rev": "ad416d066ca1222956472ab7d0555a6946746a80",
"type": "github"
},
"original": {
@ -36,19 +53,20 @@
},
"nixpkgs-lib": {
"locked": {
"lastModified": 1719876945,
"narHash": "sha256-Fm2rDDs86sHy0/1jxTOKB1118Q0O3Uc7EC0iXvXKpbI=",
"lastModified": 1725233747,
"narHash": "sha256-Ss8QWLXdr2JCBPcYChJhz4xJm+h/xjl4G0c0XlP6a74=",
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/5daf0514482af3f97abaefc78a6606365c9108e2.tar.gz"
"url": "https://github.com/NixOS/nixpkgs/archive/356624c12086a18f2ea2825fed34523d60ccc4e3.tar.gz"
},
"original": {
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/5daf0514482af3f97abaefc78a6606365c9108e2.tar.gz"
"url": "https://github.com/NixOS/nixpkgs/archive/356624c12086a18f2ea2825fed34523d60ccc4e3.tar.gz"
}
},
"root": {
"inputs": {
"flake-parts": "flake-parts",
"linux-jhovold": "linux-jhovold",
"nixpkgs": "nixpkgs"
}
}

View file

@ -2,6 +2,9 @@
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
linux-jhovold.url = "github:jhovold/linux/wip/sc8280xp-6.11-rc6";
linux-jhovold.flake = false;
};
outputs =
@ -21,7 +24,7 @@
{ pkgs, ... }:
{
devShells = rec {
default = pkgs.mkShellNoCC { packages = [ pkgs.npins ] ++ ci.nativeBuildInputs; };
default = pkgs.mkShellNoCC { packages = ci.nativeBuildInputs; };
ci = pkgs.mkShellNoCC {
packages = [
@ -36,9 +39,16 @@
];
};
};
formatter = pkgs.nixfmt-rfc-style;
};
flake.nixosModules.default = import ./module.nix { inherit dtbName; };
flake.nixosModules.default = import ./module.nix {
inherit dtbName;
# FIXME: don't hardcode this with the arch
x13sPackages = self.packages.aarch64-linux;
};
flake.nixosConfigurations = {
example = inputs.nixpkgs.lib.nixosSystem {

View file

@ -1,4 +1,4 @@
{ dtbName }:
{ dtbName, x13sPackages }:
{
config,
lib,
@ -9,8 +9,6 @@
let
cfg = config.nixos-x13s;
x13sPackages = import ./packages/default.nix { inherit lib pkgs; };
linuxPackages_x13s =
if cfg.kernel == "mainline" then
pkgs.linuxPackages_latest

View file

@ -1,47 +0,0 @@
# Generated by npins. Do not modify; will be overwritten regularly
let
data = builtins.fromJSON (builtins.readFile ./sources.json);
version = data.version;
mkSource = spec:
assert spec ? type; let
path =
if spec.type == "Git" then mkGitSource spec
else if spec.type == "GitRelease" then mkGitSource spec
else if spec.type == "PyPi" then mkPyPiSource spec
else if spec.type == "Channel" then mkChannelSource spec
else builtins.throw "Unknown source type ${spec.type}";
in
spec // { outPath = path; };
mkGitSource = { repository, revision, url ? null, hash, ... }:
assert repository ? type;
# At the moment, either it is a plain git repository (which has an url), or it is a GitHub/GitLab repository
# In the latter case, there we will always be an url to the tarball
if url != null then
(builtins.fetchTarball {
inherit url;
sha256 = hash; # FIXME: check nix version & use SRI hashes
})
else assert repository.type == "Git"; builtins.fetchGit {
url = repository.url;
rev = revision;
# hash = hash;
};
mkPyPiSource = { url, hash, ... }:
builtins.fetchurl {
inherit url;
sha256 = hash;
};
mkChannelSource = { url, hash, ... }:
builtins.fetchTarball {
inherit url;
sha256 = hash;
};
in
if version == 3 then
builtins.mapAttrs (_: mkSource) data.pins
else
throw "Unsupported format version ${toString version} in sources.json. Try running `npins upgrade`"

View file

@ -1,17 +0,0 @@
{
"pins": {
"linux-jhovold": {
"type": "Git",
"repository": {
"type": "GitHub",
"owner": "jhovold",
"repo": "linux"
},
"branch": "wip/sc8280xp-6.11-rc1",
"revision": "9c6b81022b9c277d65c68e25f4cfd52f33ef8f28",
"url": "https://github.com/jhovold/linux/archive/9c6b81022b9c277d65c68e25f4cfd52f33ef8f28.tar.gz",
"hash": "13c6r67iy8y750f8zpals4l941lshxx3w3ar1ss9dizsqjsghdsr"
}
},
"version": 3
}

View file

@ -1,6 +1,10 @@
{ lib, pkgs, ... }:
{
inputs,
lib,
pkgs,
...
}:
let
sources = import ../npins;
linux_x13s_pkg =
{ version, buildLinux, ... }@args:
@ -16,8 +20,8 @@ let
in
{
linux_jhovold = pkgs.callPackage linux_x13s_pkg {
src = sources.linux-jhovold;
version = "6.11.0-rc1";
src = inputs.linux-jhovold;
version = "6.11-rc6";
defconfig = "johan_defconfig";
};

View file

@ -1,4 +1,9 @@
{ lib, withSystem, ... }:
{
inputs,
lib,
withSystem,
...
}:
{
perSystem =
{ pkgs, ... }:
@ -10,6 +15,6 @@
};
flake.packages.aarch64-linux = withSystem "aarch64-linux" (
{ pkgs, ... }: import ./default.nix { inherit lib pkgs; }
{ pkgs, ... }: import ./default.nix { inherit inputs lib pkgs; }
);
}

View file

@ -1,55 +0,0 @@
#!/usr/bin/env python3
from github import Github
import sys
import re
from packaging.version import Version
from subprocess import run
latest_version: str = "0"
latest_branch: str = ""
previous_version: str = ""
with Github() as gh:
for branch in gh.get_user("jhovold").get_repo("linux").get_branches():
v = re.match("wip/sc8280xp-((v?6.[0-9]+)(-rc[0-9]+)?)", branch.name)
if v != None and Version(v.group(1)) > Version(latest_version):
# add .0 to version
latest_version = f"{v.group(2)}.0{v.group(3) or ''}"
latest_branch = v.group(0)
print("branch: " + latest_branch)
print("latest: " + latest_version)
with open("packages/default.nix", "r") as f:
lines = f.readlines()
for line in lines:
v = re.match(r'^\s*version = "(6[.0-9-rc]+)";.*$', line)
if v != None:
previous_version = v.group(1)
print("previous: " + previous_version)
if previous_version == latest_version:
print("No update found, exiting.")
sys.exit(1)
with open("packages/default.nix", "w") as f:
for line in lines:
f.write(
re.sub(
r'^(\s*version = ")6[.0-9-rc]+(";.*$)',
rf"\g<1>{latest_version}\2",
line,
)
)
run(
f"npins add --name linux-jhovold github --branch {latest_branch} jhovold linux".split(
" "
)
)
run("git add npins/ packages/default.nix".split(" "))
run(["git", "commit", "-m", f"jhovold: {previous_version} -> {latest_version}"])