summary refs log tree commit diff
path: root/pkgs/os-specific/linux/kernel/mainline.nix
diff options
context:
space:
mode:
authorK900 <me@0upti.me>2023-09-22 14:28:05 +0300
committerK900 <me@0upti.me>2023-09-22 16:09:59 +0300
commitc08efe1438362d2cdcb64849bd7e28dd688b55f6 (patch)
treee516fd3ec944e11015b87eab683993e9c9cb7d47 /pkgs/os-specific/linux/kernel/mainline.nix
parentc792f6b81a1ea61370b87daabb7ff1ad5660efb3 (diff)
downloadnixpkgs-c08efe1438362d2cdcb64849bd7e28dd688b55f6.tar
nixpkgs-c08efe1438362d2cdcb64849bd7e28dd688b55f6.tar.gz
nixpkgs-c08efe1438362d2cdcb64849bd7e28dd688b55f6.tar.bz2
nixpkgs-c08efe1438362d2cdcb64849bd7e28dd688b55f6.tar.lz
nixpkgs-c08efe1438362d2cdcb64849bd7e28dd688b55f6.tar.xz
nixpkgs-c08efe1438362d2cdcb64849bd7e28dd688b55f6.tar.zst
nixpkgs-c08efe1438362d2cdcb64849bd7e28dd688b55f6.zip
linux: more update-script cleanups/fixes
- special case linux-testing fetching
- use hash instead of sha256 everywhere
- respect COMMIT envvar

This causes rebuilds, so should go in with the next bump probably.
Diffstat (limited to 'pkgs/os-specific/linux/kernel/mainline.nix')
-rw-r--r--pkgs/os-specific/linux/kernel/mainline.nix25
1 files changed, 17 insertions, 8 deletions
diff --git a/pkgs/os-specific/linux/kernel/mainline.nix b/pkgs/os-specific/linux/kernel/mainline.nix
index 50053e620e4..4e1d5b8a9e8 100644
--- a/pkgs/os-specific/linux/kernel/mainline.nix
+++ b/pkgs/os-specific/linux/kernel/mainline.nix
@@ -1,18 +1,27 @@
-{ branch, lib, fetchurl, buildLinux, ... } @ args:
+{ branch, lib, fetchurl, fetchzip, buildLinux, ... } @ args:
 
 let
   allKernels = builtins.fromJSON (builtins.readFile ./kernels-org.json);
   thisKernel = allKernels.${branch};
+  inherit (thisKernel) version;
+
+  src =
+    # testing kernels are a special case because they don't have tarballs on the CDN
+    if branch == "testing"
+      then fetchzip {
+        url = "https://git.kernel.org/torvalds/t/linux-${version}.tar.gz";
+        inherit (thisKernel) hash;
+      }
+      else fetchurl {
+        url = "mirror://kernel/linux/kernel/v${lib.versions.major version}.x/linux-${version}.tar.xz";
+        inherit (thisKernel) hash;
+      };
+
+  args' = (builtins.removeAttrs args ["branch"]) // {
+    inherit src version;
 
-  args' = (builtins.removeAttrs args ["branch"]) // rec {
-    inherit (thisKernel) version;
     modDirVersion = lib.versions.pad 3 version;
     extraMeta.branch = branch;
-
-    src = fetchurl {
-      url = "mirror://kernel/linux/kernel/v${lib.versions.major version}.x/linux-${version}.tar.xz";
-      sha256 = thisKernel.hash;
-    };
   } // (args.argsOverride or {});
 in
 buildLinux args'