mirror of
https://github.com/xddxdd/nix-cachyos-kernel.git
synced 2026-07-03 11:08:07 +02:00
Use prepatched kernel source code from github.com/CachyOS/linux/releases
This commit is contained in:
parent
30dccb243a
commit
a3da912207
1
.github/workflows/auto-update.yml
vendored
1
.github/workflows/auto-update.yml
vendored
@ -66,6 +66,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
export TMPDIR=/nix/tmpdir
|
export TMPDIR=/nix/tmpdir
|
||||||
nix flake update
|
nix flake update
|
||||||
|
nix run .#update-kernel-cachyos
|
||||||
nix run .#update-zfs-cachyos
|
nix run .#update-zfs-cachyos
|
||||||
|
|
||||||
- name: Commit back to repository
|
- name: Commit back to repository
|
||||||
|
|||||||
17
flake.nix
17
flake.nix
@ -80,23 +80,30 @@
|
|||||||
# Packages only contain linux-cachyos-* due to Flake schema requirements
|
# Packages only contain linux-cachyos-* due to Flake schema requirements
|
||||||
packages = lib.filterAttrs (_: lib.isDerivation) legacyPackages;
|
packages = lib.filterAttrs (_: lib.isDerivation) legacyPackages;
|
||||||
|
|
||||||
apps.update-zfs-cachyos = {
|
apps =
|
||||||
|
let
|
||||||
|
mkApp = name: script: {
|
||||||
type = "app";
|
type = "app";
|
||||||
program =
|
program =
|
||||||
let
|
let
|
||||||
python = pkgs.python3.withPackages (ps: [ ps.requests ]);
|
python = pkgs.python3.withPackages (ps: [ ps.requests ]);
|
||||||
script = pkgs.writeShellApplication {
|
app = pkgs.writeShellApplication {
|
||||||
name = "update-zfs-cachyos";
|
inherit name;
|
||||||
runtimeInputs = [
|
runtimeInputs = [
|
||||||
python
|
python
|
||||||
pkgs.nix-prefetch-git
|
pkgs.nix-prefetch-git
|
||||||
];
|
];
|
||||||
text = ''
|
text = ''
|
||||||
python3 ${./zfs-cachyos/update.py}
|
python3 ${script}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
lib.getExe script;
|
lib.getExe app;
|
||||||
|
};
|
||||||
|
in
|
||||||
|
{
|
||||||
|
update-kernel-cachyos = mkApp "update-lernel-cachyos" ./kernel-cachyos/update.py;
|
||||||
|
update-zfs-cachyos = mkApp "update-zfs-cachyos" ./zfs-cachyos/update.py;
|
||||||
};
|
};
|
||||||
|
|
||||||
# Allow build unfree modules such as nvidia_x11
|
# Allow build unfree modules such as nvidia_x11
|
||||||
|
|||||||
@ -2,76 +2,81 @@
|
|||||||
inputs,
|
inputs,
|
||||||
callPackage,
|
callPackage,
|
||||||
lib,
|
lib,
|
||||||
linux_latest,
|
fetchurl,
|
||||||
linux_testing,
|
|
||||||
linux,
|
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
mkCachyKernel = callPackage ./mkCachyKernel.nix { inherit inputs; };
|
mkCachyKernel = callPackage ./mkCachyKernel.nix { inherit inputs; };
|
||||||
|
|
||||||
|
linuxSources = lib.mapAttrs (_: v: {
|
||||||
|
inherit (v) version;
|
||||||
|
src = fetchurl {
|
||||||
|
inherit (v) url hash;
|
||||||
|
};
|
||||||
|
}) (lib.importJSON ./version.json);
|
||||||
in
|
in
|
||||||
builtins.listToAttrs (
|
builtins.listToAttrs (
|
||||||
builtins.map (v: lib.nameValuePair v.pname v) [
|
builtins.map (v: lib.nameValuePair v.pname v) [
|
||||||
# Latest kernel, provide all LTO/CPU arch variants
|
# Latest kernel, provide all LTO/CPU arch variants
|
||||||
(mkCachyKernel {
|
(mkCachyKernel {
|
||||||
pname = "linux-cachyos-latest";
|
pname = "linux-cachyos-latest";
|
||||||
inherit (linux_latest) version src;
|
inherit (linuxSources.latest) version src;
|
||||||
configVariant = "linux-cachyos";
|
configVariant = "linux-cachyos";
|
||||||
})
|
})
|
||||||
(mkCachyKernel {
|
(mkCachyKernel {
|
||||||
pname = "linux-cachyos-latest-x86_64-v2";
|
pname = "linux-cachyos-latest-x86_64-v2";
|
||||||
inherit (linux_latest) version src;
|
inherit (linuxSources.latest) version src;
|
||||||
configVariant = "linux-cachyos";
|
configVariant = "linux-cachyos";
|
||||||
processorOpt = "x86_64-v2";
|
processorOpt = "x86_64-v2";
|
||||||
})
|
})
|
||||||
(mkCachyKernel {
|
(mkCachyKernel {
|
||||||
pname = "linux-cachyos-latest-x86_64-v3";
|
pname = "linux-cachyos-latest-x86_64-v3";
|
||||||
inherit (linux_latest) version src;
|
inherit (linuxSources.latest) version src;
|
||||||
configVariant = "linux-cachyos";
|
configVariant = "linux-cachyos";
|
||||||
processorOpt = "x86_64-v3";
|
processorOpt = "x86_64-v3";
|
||||||
})
|
})
|
||||||
(mkCachyKernel {
|
(mkCachyKernel {
|
||||||
pname = "linux-cachyos-latest-x86_64-v4";
|
pname = "linux-cachyos-latest-x86_64-v4";
|
||||||
inherit (linux_latest) version src;
|
inherit (linuxSources.latest) version src;
|
||||||
configVariant = "linux-cachyos";
|
configVariant = "linux-cachyos";
|
||||||
processorOpt = "x86_64-v4";
|
processorOpt = "x86_64-v4";
|
||||||
})
|
})
|
||||||
(mkCachyKernel {
|
(mkCachyKernel {
|
||||||
pname = "linux-cachyos-latest-zen4";
|
pname = "linux-cachyos-latest-zen4";
|
||||||
inherit (linux_latest) version src;
|
inherit (linuxSources.latest) version src;
|
||||||
configVariant = "linux-cachyos";
|
configVariant = "linux-cachyos";
|
||||||
processorOpt = "zen4";
|
processorOpt = "zen4";
|
||||||
})
|
})
|
||||||
(mkCachyKernel {
|
(mkCachyKernel {
|
||||||
pname = "linux-cachyos-latest-lto";
|
pname = "linux-cachyos-latest-lto";
|
||||||
inherit (linux_latest) version src;
|
inherit (linuxSources.latest) version src;
|
||||||
configVariant = "linux-cachyos";
|
configVariant = "linux-cachyos";
|
||||||
lto = "thin";
|
lto = "thin";
|
||||||
})
|
})
|
||||||
(mkCachyKernel {
|
(mkCachyKernel {
|
||||||
pname = "linux-cachyos-latest-lto-x86_64-v2";
|
pname = "linux-cachyos-latest-lto-x86_64-v2";
|
||||||
inherit (linux_latest) version src;
|
inherit (linuxSources.latest) version src;
|
||||||
configVariant = "linux-cachyos";
|
configVariant = "linux-cachyos";
|
||||||
lto = "thin";
|
lto = "thin";
|
||||||
processorOpt = "x86_64-v2";
|
processorOpt = "x86_64-v2";
|
||||||
})
|
})
|
||||||
(mkCachyKernel {
|
(mkCachyKernel {
|
||||||
pname = "linux-cachyos-latest-lto-x86_64-v3";
|
pname = "linux-cachyos-latest-lto-x86_64-v3";
|
||||||
inherit (linux_latest) version src;
|
inherit (linuxSources.latest) version src;
|
||||||
configVariant = "linux-cachyos";
|
configVariant = "linux-cachyos";
|
||||||
lto = "thin";
|
lto = "thin";
|
||||||
processorOpt = "x86_64-v3";
|
processorOpt = "x86_64-v3";
|
||||||
})
|
})
|
||||||
(mkCachyKernel {
|
(mkCachyKernel {
|
||||||
pname = "linux-cachyos-latest-lto-x86_64-v4";
|
pname = "linux-cachyos-latest-lto-x86_64-v4";
|
||||||
inherit (linux_latest) version src;
|
inherit (linuxSources.latest) version src;
|
||||||
configVariant = "linux-cachyos";
|
configVariant = "linux-cachyos";
|
||||||
lto = "thin";
|
lto = "thin";
|
||||||
processorOpt = "x86_64-v4";
|
processorOpt = "x86_64-v4";
|
||||||
})
|
})
|
||||||
(mkCachyKernel {
|
(mkCachyKernel {
|
||||||
pname = "linux-cachyos-latest-lto-zen4";
|
pname = "linux-cachyos-latest-lto-zen4";
|
||||||
inherit (linux_latest) version src;
|
inherit (linuxSources.latest) version src;
|
||||||
configVariant = "linux-cachyos";
|
configVariant = "linux-cachyos";
|
||||||
lto = "thin";
|
lto = "thin";
|
||||||
processorOpt = "zen4";
|
processorOpt = "zen4";
|
||||||
@ -80,63 +85,63 @@ builtins.listToAttrs (
|
|||||||
# LTS kernel
|
# LTS kernel
|
||||||
(mkCachyKernel {
|
(mkCachyKernel {
|
||||||
pname = "linux-cachyos-lts";
|
pname = "linux-cachyos-lts";
|
||||||
inherit (linux) version src;
|
inherit (linuxSources.lts) version src;
|
||||||
configVariant = "linux-cachyos-lts";
|
configVariant = "linux-cachyos-lts";
|
||||||
})
|
})
|
||||||
(mkCachyKernel {
|
(mkCachyKernel {
|
||||||
pname = "linux-cachyos-lts-x86_64-v2";
|
pname = "linux-cachyos-lts-x86_64-v2";
|
||||||
inherit (linux) version src;
|
inherit (linuxSources.lts) version src;
|
||||||
configVariant = "linux-cachyos-lts";
|
configVariant = "linux-cachyos-lts";
|
||||||
processorOpt = "x86_64-v2";
|
processorOpt = "x86_64-v2";
|
||||||
})
|
})
|
||||||
(mkCachyKernel {
|
(mkCachyKernel {
|
||||||
pname = "linux-cachyos-lts-x86_64-v3";
|
pname = "linux-cachyos-lts-x86_64-v3";
|
||||||
inherit (linux) version src;
|
inherit (linuxSources.lts) version src;
|
||||||
configVariant = "linux-cachyos-lts";
|
configVariant = "linux-cachyos-lts";
|
||||||
processorOpt = "x86_64-v3";
|
processorOpt = "x86_64-v3";
|
||||||
})
|
})
|
||||||
(mkCachyKernel {
|
(mkCachyKernel {
|
||||||
pname = "linux-cachyos-lts-x86_64-v4";
|
pname = "linux-cachyos-lts-x86_64-v4";
|
||||||
inherit (linux) version src;
|
inherit (linuxSources.lts) version src;
|
||||||
configVariant = "linux-cachyos-lts";
|
configVariant = "linux-cachyos-lts";
|
||||||
processorOpt = "x86_64-v4";
|
processorOpt = "x86_64-v4";
|
||||||
})
|
})
|
||||||
(mkCachyKernel {
|
(mkCachyKernel {
|
||||||
pname = "linux-cachyos-lts-zen4";
|
pname = "linux-cachyos-lts-zen4";
|
||||||
inherit (linux) version src;
|
inherit (linuxSources.lts) version src;
|
||||||
configVariant = "linux-cachyos-lts";
|
configVariant = "linux-cachyos-lts";
|
||||||
processorOpt = "zen4";
|
processorOpt = "zen4";
|
||||||
})
|
})
|
||||||
(mkCachyKernel {
|
(mkCachyKernel {
|
||||||
pname = "linux-cachyos-lts-lto";
|
pname = "linux-cachyos-lts-lto";
|
||||||
inherit (linux) version src;
|
inherit (linuxSources.lts) version src;
|
||||||
configVariant = "linux-cachyos-lts";
|
configVariant = "linux-cachyos-lts";
|
||||||
lto = "thin";
|
lto = "thin";
|
||||||
})
|
})
|
||||||
(mkCachyKernel {
|
(mkCachyKernel {
|
||||||
pname = "linux-cachyos-lts-lto-x86_64-v2";
|
pname = "linux-cachyos-lts-lto-x86_64-v2";
|
||||||
inherit (linux) version src;
|
inherit (linuxSources.lts) version src;
|
||||||
configVariant = "linux-cachyos-lts";
|
configVariant = "linux-cachyos-lts";
|
||||||
lto = "thin";
|
lto = "thin";
|
||||||
processorOpt = "x86_64-v2";
|
processorOpt = "x86_64-v2";
|
||||||
})
|
})
|
||||||
(mkCachyKernel {
|
(mkCachyKernel {
|
||||||
pname = "linux-cachyos-lts-lto-x86_64-v3";
|
pname = "linux-cachyos-lts-lto-x86_64-v3";
|
||||||
inherit (linux) version src;
|
inherit (linuxSources.lts) version src;
|
||||||
configVariant = "linux-cachyos-lts";
|
configVariant = "linux-cachyos-lts";
|
||||||
lto = "thin";
|
lto = "thin";
|
||||||
processorOpt = "x86_64-v3";
|
processorOpt = "x86_64-v3";
|
||||||
})
|
})
|
||||||
(mkCachyKernel {
|
(mkCachyKernel {
|
||||||
pname = "linux-cachyos-lts-lto-x86_64-v4";
|
pname = "linux-cachyos-lts-lto-x86_64-v4";
|
||||||
inherit (linux) version src;
|
inherit (linuxSources.lts) version src;
|
||||||
configVariant = "linux-cachyos-lts";
|
configVariant = "linux-cachyos-lts";
|
||||||
lto = "thin";
|
lto = "thin";
|
||||||
processorOpt = "x86_64-v4";
|
processorOpt = "x86_64-v4";
|
||||||
})
|
})
|
||||||
(mkCachyKernel {
|
(mkCachyKernel {
|
||||||
pname = "linux-cachyos-lts-lto-zen4";
|
pname = "linux-cachyos-lts-lto-zen4";
|
||||||
inherit (linux) version src;
|
inherit (linuxSources.lts) version src;
|
||||||
configVariant = "linux-cachyos-lts";
|
configVariant = "linux-cachyos-lts";
|
||||||
lto = "thin";
|
lto = "thin";
|
||||||
processorOpt = "zen4";
|
processorOpt = "zen4";
|
||||||
@ -145,40 +150,40 @@ builtins.listToAttrs (
|
|||||||
# Additional CachyOS provided variants
|
# Additional CachyOS provided variants
|
||||||
(mkCachyKernel {
|
(mkCachyKernel {
|
||||||
pname = "linux-cachyos-bmq";
|
pname = "linux-cachyos-bmq";
|
||||||
inherit (linux_latest) version src;
|
inherit (linuxSources.latest) version src;
|
||||||
configVariant = "linux-cachyos-bmq";
|
configVariant = "linux-cachyos-bmq";
|
||||||
cpusched = "bmq";
|
cpusched = "bmq";
|
||||||
})
|
})
|
||||||
(mkCachyKernel {
|
(mkCachyKernel {
|
||||||
pname = "linux-cachyos-bmq-lto";
|
pname = "linux-cachyos-bmq-lto";
|
||||||
inherit (linux_latest) version src;
|
inherit (linuxSources.latest) version src;
|
||||||
configVariant = "linux-cachyos-bmq";
|
configVariant = "linux-cachyos-bmq";
|
||||||
lto = "thin";
|
lto = "thin";
|
||||||
cpusched = "bmq";
|
cpusched = "bmq";
|
||||||
})
|
})
|
||||||
(mkCachyKernel {
|
(mkCachyKernel {
|
||||||
pname = "linux-cachyos-bore";
|
pname = "linux-cachyos-bore";
|
||||||
inherit (linux_latest) version src;
|
inherit (linuxSources.latest) version src;
|
||||||
configVariant = "linux-cachyos-bore";
|
configVariant = "linux-cachyos-bore";
|
||||||
cpusched = "bore";
|
cpusched = "bore";
|
||||||
})
|
})
|
||||||
(mkCachyKernel {
|
(mkCachyKernel {
|
||||||
pname = "linux-cachyos-bore-lto";
|
pname = "linux-cachyos-bore-lto";
|
||||||
inherit (linux_latest) version src;
|
inherit (linuxSources.latest) version src;
|
||||||
configVariant = "linux-cachyos-bore";
|
configVariant = "linux-cachyos-bore";
|
||||||
lto = "thin";
|
lto = "thin";
|
||||||
cpusched = "bore";
|
cpusched = "bore";
|
||||||
})
|
})
|
||||||
(mkCachyKernel {
|
(mkCachyKernel {
|
||||||
pname = "linux-cachyos-deckify";
|
pname = "linux-cachyos-deckify";
|
||||||
inherit (linux_latest) version src;
|
inherit (linuxSources.latest) version src;
|
||||||
configVariant = "linux-cachyos-deckify";
|
configVariant = "linux-cachyos-deckify";
|
||||||
acpiCall = true;
|
acpiCall = true;
|
||||||
handheld = true;
|
handheld = true;
|
||||||
})
|
})
|
||||||
(mkCachyKernel {
|
(mkCachyKernel {
|
||||||
pname = "linux-cachyos-deckify-lto";
|
pname = "linux-cachyos-deckify-lto";
|
||||||
inherit (linux_latest) version src;
|
inherit (linuxSources.latest) version src;
|
||||||
configVariant = "linux-cachyos-deckify";
|
configVariant = "linux-cachyos-deckify";
|
||||||
lto = "thin";
|
lto = "thin";
|
||||||
acpiCall = true;
|
acpiCall = true;
|
||||||
@ -186,51 +191,51 @@ builtins.listToAttrs (
|
|||||||
})
|
})
|
||||||
(mkCachyKernel {
|
(mkCachyKernel {
|
||||||
pname = "linux-cachyos-eevdf";
|
pname = "linux-cachyos-eevdf";
|
||||||
inherit (linux_latest) version src;
|
inherit (linuxSources.latest) version src;
|
||||||
configVariant = "linux-cachyos-eevdf";
|
configVariant = "linux-cachyos-eevdf";
|
||||||
cpusched = "eevdf";
|
cpusched = "eevdf";
|
||||||
})
|
})
|
||||||
(mkCachyKernel {
|
(mkCachyKernel {
|
||||||
pname = "linux-cachyos-eevdf-lto";
|
pname = "linux-cachyos-eevdf-lto";
|
||||||
inherit (linux_latest) version src;
|
inherit (linuxSources.latest) version src;
|
||||||
configVariant = "linux-cachyos-eevdf";
|
configVariant = "linux-cachyos-eevdf";
|
||||||
cpusched = "eevdf";
|
cpusched = "eevdf";
|
||||||
lto = "thin";
|
lto = "thin";
|
||||||
})
|
})
|
||||||
(mkCachyKernel {
|
(mkCachyKernel {
|
||||||
pname = "linux-cachyos-hardened";
|
pname = "linux-cachyos-hardened";
|
||||||
inherit (linux_latest) version src;
|
inherit (linuxSources.latest) version src;
|
||||||
configVariant = "linux-cachyos-hardened";
|
configVariant = "linux-cachyos-hardened";
|
||||||
hardened = true;
|
hardened = true;
|
||||||
})
|
})
|
||||||
(mkCachyKernel {
|
(mkCachyKernel {
|
||||||
pname = "linux-cachyos-hardened-lto";
|
pname = "linux-cachyos-hardened-lto";
|
||||||
inherit (linux_latest) version src;
|
inherit (linuxSources.latest) version src;
|
||||||
configVariant = "linux-cachyos-hardened";
|
configVariant = "linux-cachyos-hardened";
|
||||||
hardened = true;
|
hardened = true;
|
||||||
lto = "thin";
|
lto = "thin";
|
||||||
})
|
})
|
||||||
(mkCachyKernel {
|
(mkCachyKernel {
|
||||||
pname = "linux-cachyos-rc";
|
pname = "linux-cachyos-rc";
|
||||||
inherit (linux_testing) version src;
|
inherit (linuxSources.rc) version src;
|
||||||
configVariant = "linux-cachyos-rc";
|
configVariant = "linux-cachyos-rc";
|
||||||
})
|
})
|
||||||
(mkCachyKernel {
|
(mkCachyKernel {
|
||||||
pname = "linux-cachyos-rc-lto";
|
pname = "linux-cachyos-rc-lto";
|
||||||
inherit (linux_testing) version src;
|
inherit (linuxSources.rc) version src;
|
||||||
configVariant = "linux-cachyos-rc";
|
configVariant = "linux-cachyos-rc";
|
||||||
lto = "thin";
|
lto = "thin";
|
||||||
})
|
})
|
||||||
(mkCachyKernel {
|
(mkCachyKernel {
|
||||||
pname = "linux-cachyos-rt-bore";
|
pname = "linux-cachyos-rt-bore";
|
||||||
inherit (linux_latest) version src;
|
inherit (linuxSources.latest) version src;
|
||||||
configVariant = "linux-cachyos-rt-bore";
|
configVariant = "linux-cachyos-rt-bore";
|
||||||
rt = true;
|
rt = true;
|
||||||
cpusched = "bore";
|
cpusched = "bore";
|
||||||
})
|
})
|
||||||
(mkCachyKernel {
|
(mkCachyKernel {
|
||||||
pname = "linux-cachyos-rt-bore-lto";
|
pname = "linux-cachyos-rt-bore-lto";
|
||||||
inherit (linux_latest) version src;
|
inherit (linuxSources.latest) version src;
|
||||||
configVariant = "linux-cachyos-rt-bore";
|
configVariant = "linux-cachyos-rt-bore";
|
||||||
rt = true;
|
rt = true;
|
||||||
cpusched = "bore";
|
cpusched = "bore";
|
||||||
@ -238,7 +243,7 @@ builtins.listToAttrs (
|
|||||||
})
|
})
|
||||||
(mkCachyKernel {
|
(mkCachyKernel {
|
||||||
pname = "linux-cachyos-server";
|
pname = "linux-cachyos-server";
|
||||||
inherit (linux_latest) version src;
|
inherit (linuxSources.latest) version src;
|
||||||
configVariant = "linux-cachyos-server";
|
configVariant = "linux-cachyos-server";
|
||||||
cpusched = "eevdf";
|
cpusched = "eevdf";
|
||||||
hzTicks = "300";
|
hzTicks = "300";
|
||||||
@ -246,7 +251,7 @@ builtins.listToAttrs (
|
|||||||
})
|
})
|
||||||
(mkCachyKernel {
|
(mkCachyKernel {
|
||||||
pname = "linux-cachyos-server-lto";
|
pname = "linux-cachyos-server-lto";
|
||||||
inherit (linux_latest) version src;
|
inherit (linuxSources.latest) version src;
|
||||||
configVariant = "linux-cachyos-server";
|
configVariant = "linux-cachyos-server";
|
||||||
cpusched = "eevdf";
|
cpusched = "eevdf";
|
||||||
hzTicks = "300";
|
hzTicks = "300";
|
||||||
|
|||||||
@ -83,8 +83,7 @@ lib.makeOverridable (
|
|||||||
|
|
||||||
cachyosConfigFile = "${inputs.cachyos-kernel.outPath}/${configVariant}/config";
|
cachyosConfigFile = "${inputs.cachyos-kernel.outPath}/${configVariant}/config";
|
||||||
cachyosPatches = builtins.map (p: "${inputs.cachyos-kernel-patches.outPath}/${patchVersion}/${p}") (
|
cachyosPatches = builtins.map (p: "${inputs.cachyos-kernel-patches.outPath}/${patchVersion}/${p}") (
|
||||||
[ "all/0001-cachyos-base-all.patch" ]
|
(lib.optional (cpusched == "bore") "sched/0001-bore-cachy.patch")
|
||||||
++ (lib.optional (cpusched == "bore") "sched/0001-bore-cachy.patch")
|
|
||||||
++ (lib.optional (cpusched == "bmq") "sched/0001-prjc-cachy.patch")
|
++ (lib.optional (cpusched == "bmq") "sched/0001-prjc-cachy.patch")
|
||||||
++ (lib.optional hardened "misc/0001-hardened.patch")
|
++ (lib.optional hardened "misc/0001-hardened.patch")
|
||||||
++ (lib.optional rt "misc/0001-rt-i915.patch")
|
++ (lib.optional rt "misc/0001-rt-i915.patch")
|
||||||
|
|||||||
84
kernel-cachyos/update.py
Normal file
84
kernel-cachyos/update.py
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
import json
|
||||||
|
from pathlib import Path
|
||||||
|
import re
|
||||||
|
import subprocess
|
||||||
|
|
||||||
|
import requests
|
||||||
|
|
||||||
|
|
||||||
|
def get_srctag(variant: str = "latest") -> str:
|
||||||
|
pkgbuild_path = f"linux-cachyos-{variant}" if variant != "latest" else "linux-cachyos"
|
||||||
|
url = f"https://github.com/CachyOS/linux-cachyos/raw/refs/heads/master/{pkgbuild_path}/PKGBUILD"
|
||||||
|
pkgbuild = requests.get(url).text
|
||||||
|
|
||||||
|
script = pkgbuild + "\necho $_srctag"
|
||||||
|
result = subprocess.run(
|
||||||
|
["bash"],
|
||||||
|
input=script,
|
||||||
|
capture_output=True,
|
||||||
|
text=True,
|
||||||
|
check=True,
|
||||||
|
)
|
||||||
|
return result.stdout.strip()
|
||||||
|
|
||||||
|
|
||||||
|
def nix_sha256_to_sri(hash: str) -> str:
|
||||||
|
cmd = ["nix", "hash", "convert", "--hash-algo", "sha256", "--to", "sri", hash]
|
||||||
|
|
||||||
|
print(f"Running command: {' '.join(cmd)}")
|
||||||
|
result = subprocess.run(cmd, capture_output=True, text=True, timeout=300)
|
||||||
|
|
||||||
|
if result.returncode != 0:
|
||||||
|
raise RuntimeError(f"nix hash command failed with return code: {result.returncode}")
|
||||||
|
|
||||||
|
output = result.stdout.strip()
|
||||||
|
if not output:
|
||||||
|
raise RuntimeError("nix hash output is empty")
|
||||||
|
|
||||||
|
return output
|
||||||
|
|
||||||
|
|
||||||
|
def run_nix_prefetch_url(url: str) -> str:
|
||||||
|
cmd = ["nix-prefetch-url", url]
|
||||||
|
|
||||||
|
print(f"Running command: {' '.join(cmd)}")
|
||||||
|
result = subprocess.run(cmd, capture_output=True, text=True, timeout=300)
|
||||||
|
|
||||||
|
if result.returncode != 0:
|
||||||
|
raise RuntimeError(f"nix-prefetch-url command failed with return code: {result.returncode}")
|
||||||
|
|
||||||
|
output = result.stdout.strip()
|
||||||
|
if not output:
|
||||||
|
raise RuntimeError("nix-prefetch-url output is empty")
|
||||||
|
|
||||||
|
return output
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
versions = {}
|
||||||
|
for variant in ["latest", "lts", "rc"]:
|
||||||
|
print(f"{variant=}")
|
||||||
|
srctag = get_srctag(variant)
|
||||||
|
real_version = "-".join(srctag.split("-")[1:-1])
|
||||||
|
print(f"{srctag=} {real_version=}")
|
||||||
|
|
||||||
|
url = f"https://github.com/CachyOS/linux/releases/download/{srctag}/{srctag}.tar.gz"
|
||||||
|
print(f"{url=}")
|
||||||
|
hash = run_nix_prefetch_url(url)
|
||||||
|
hash = nix_sha256_to_sri(hash)
|
||||||
|
print(f"{hash=}")
|
||||||
|
versions[variant] = {
|
||||||
|
"version": real_version,
|
||||||
|
"url": url,
|
||||||
|
"hash": hash,
|
||||||
|
}
|
||||||
|
|
||||||
|
current = Path.cwd()
|
||||||
|
while not (current / "flake.lock").exists():
|
||||||
|
if current == current.parent:
|
||||||
|
raise RuntimeError("Could not find flake.lock in any parent directory, exiting")
|
||||||
|
current = current.parent
|
||||||
|
|
||||||
|
output_file = current / "kernel-cachyos" / "version.json"
|
||||||
|
with open(output_file, "w", encoding="utf-8") as f:
|
||||||
|
json.dump(versions, f, indent=2)
|
||||||
17
kernel-cachyos/version.json
Normal file
17
kernel-cachyos/version.json
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"latest": {
|
||||||
|
"version": "6.19.5",
|
||||||
|
"url": "https://github.com/CachyOS/linux/releases/download/cachyos-6.19.5-2/cachyos-6.19.5-2.tar.gz",
|
||||||
|
"hash": "sha256-KgOZl6MTmH4IvuopKArhK2fMzM1E+4zOeq9HeWUPmYY="
|
||||||
|
},
|
||||||
|
"lts": {
|
||||||
|
"version": "6.18.15",
|
||||||
|
"url": "https://github.com/CachyOS/linux/releases/download/cachyos-6.18.15-2/cachyos-6.18.15-2.tar.gz",
|
||||||
|
"hash": "sha256-WpGH+tHh6vipOwqg1ZupEL40KF9FliYVwuOiykEj0Gc="
|
||||||
|
},
|
||||||
|
"rc": {
|
||||||
|
"version": "7.0-rc1",
|
||||||
|
"url": "https://github.com/CachyOS/linux/releases/download/cachyos-7.0-rc1-2/cachyos-7.0-rc1-2.tar.gz",
|
||||||
|
"hash": "sha256-BxeMq0M0C98Wcc9d+GxYVzPNdw6hK4kmj+xW9Ck3mgg="
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user