diff options
Diffstat (limited to 'pkgs/os-specific/linux')
-rw-r--r-- | pkgs/os-specific/linux/kernel/generic.nix | 9 | ||||
-rw-r--r-- | pkgs/os-specific/linux/kernel/linux-4.14.nix | 3 | ||||
-rw-r--r-- | pkgs/os-specific/linux/kernel/linux-4.19.nix | 3 | ||||
-rw-r--r-- | pkgs/os-specific/linux/kernel/linux-5.10.nix | 3 | ||||
-rw-r--r-- | pkgs/os-specific/linux/kernel/linux-5.15.nix | 3 | ||||
-rw-r--r-- | pkgs/os-specific/linux/kernel/linux-5.4.nix | 3 | ||||
-rw-r--r-- | pkgs/os-specific/linux/kernel/linux-6.0.nix | 3 | ||||
-rw-r--r-- | pkgs/os-specific/linux/kernel/linux-6.1.nix | 3 | ||||
-rw-r--r-- | pkgs/os-specific/linux/kernel/linux-rt-5.10.nix | 3 | ||||
-rw-r--r-- | pkgs/os-specific/linux/kernel/linux-testing.nix | 3 | ||||
-rw-r--r-- | pkgs/os-specific/linux/kernel/manual-config.nix | 7 | ||||
-rw-r--r-- | pkgs/os-specific/linux/kernel/xanmod-kernels.nix | 2 | ||||
-rw-r--r-- | pkgs/os-specific/linux/kernel/zen-kernels.nix | 2 |
13 files changed, 28 insertions, 19 deletions
diff --git a/pkgs/os-specific/linux/kernel/generic.nix b/pkgs/os-specific/linux/kernel/generic.nix index 5a4c2858f95..dce2ed074a0 100644 --- a/pkgs/os-specific/linux/kernel/generic.nix +++ b/pkgs/os-specific/linux/kernel/generic.nix @@ -29,7 +29,8 @@ structuredExtraConfig ? {} , # The version number used for the module directory - modDirVersion ? version + # If unspecified, this is determined automatically from the version. + modDirVersion ? null , # An attribute set whose attributes express the availability of # certain features in this kernel. E.g. `{iwlwifi = true;}' @@ -195,15 +196,15 @@ let }; # end of configfile derivation kernel = (callPackage ./manual-config.nix { inherit buildPackages; }) (basicArgs // { - inherit modDirVersion kernelPatches randstructSeed lib stdenv extraMakeFlags extraMeta configfile; + inherit kernelPatches randstructSeed lib stdenv extraMakeFlags extraMeta configfile; pos = builtins.unsafeGetAttrPos "version" args; config = { CONFIG_MODULES = "y"; CONFIG_FW_LOADER = "m"; }; - }); + } // lib.optionalAttrs (modDirVersion != null) { inherit modDirVersion; }); passthru = basicArgs // { features = kernelFeatures; - inherit commonStructuredConfig structuredExtraConfig extraMakeFlags isZen isHardened isLibre modDirVersion; + inherit commonStructuredConfig structuredExtraConfig extraMakeFlags isZen isHardened isLibre; isXen = lib.warn "The isXen attribute is deprecated. All Nixpkgs kernels that support it now have Xen enabled." true; passthru = kernel.passthru // (removeAttrs passthru [ "passthru" ]); tests = let diff --git a/pkgs/os-specific/linux/kernel/linux-4.14.nix b/pkgs/os-specific/linux/kernel/linux-4.14.nix index 02893f731e3..777aa852650 100644 --- a/pkgs/os-specific/linux/kernel/linux-4.14.nix +++ b/pkgs/os-specific/linux/kernel/linux-4.14.nix @@ -6,7 +6,7 @@ buildLinux (args // rec { version = "4.14.302"; # modDirVersion needs to be x.y.z, will automatically add .0 if needed - modDirVersion = if (modDirVersionArg == null) then concatStringsSep "." (take 3 (splitVersion "${version}.0")) else modDirVersionArg; + modDirVersion = versions.pad 3 version; # branchVersion needs to be x.y extraMeta.branch = versions.majorMinor version; @@ -16,3 +16,4 @@ buildLinux (args // rec { sha256 = "102c9h0byr9v4bxzkdh7mnw1grm47ji6lf6l1gjlwah7f46j6ap3"; }; } // (args.argsOverride or {})) + // lib.optionalAttrs (modDirVersionArg != null) { modDirVersion = modDirVersionArg; } # legacy diff --git a/pkgs/os-specific/linux/kernel/linux-4.19.nix b/pkgs/os-specific/linux/kernel/linux-4.19.nix index 44a976ef0c7..6c5531afd6f 100644 --- a/pkgs/os-specific/linux/kernel/linux-4.19.nix +++ b/pkgs/os-specific/linux/kernel/linux-4.19.nix @@ -6,7 +6,7 @@ buildLinux (args // rec { version = "4.19.269"; # modDirVersion needs to be x.y.z, will automatically add .0 if needed - modDirVersion = if (modDirVersionArg == null) then concatStringsSep "." (take 3 (splitVersion "${version}.0")) else modDirVersionArg; + modDirVersion = versions.pad 3 version; # branchVersion needs to be x.y extraMeta.branch = versions.majorMinor version; @@ -16,3 +16,4 @@ buildLinux (args // rec { sha256 = "02mjb16xxfj984vibpxvhjl84y5yg0jgzjccjdxnn8db4k9aa2vf"; }; } // (args.argsOverride or {})) + // lib.optionalAttrs (modDirVersionArg != null) { modDirVersion = modDirVersionArg; } # legacy diff --git a/pkgs/os-specific/linux/kernel/linux-5.10.nix b/pkgs/os-specific/linux/kernel/linux-5.10.nix index 5614aeb1cab..7662f6be96c 100644 --- a/pkgs/os-specific/linux/kernel/linux-5.10.nix +++ b/pkgs/os-specific/linux/kernel/linux-5.10.nix @@ -6,7 +6,7 @@ buildLinux (args // rec { version = "5.10.159"; # modDirVersion needs to be x.y.z, will automatically add .0 if needed - modDirVersion = if (modDirVersionArg == null) then concatStringsSep "." (take 3 (splitVersion "${version}.0")) else modDirVersionArg; + modDirVersion = versions.pad 3 version; # branchVersion needs to be x.y extraMeta.branch = versions.majorMinor version; @@ -16,3 +16,4 @@ buildLinux (args // rec { sha256 = "19yfi5vknxnw0cb8274q3pb5zjs6ny04n16m8xjdfdmznrbvza8v"; }; } // (args.argsOverride or {})) + // lib.optionalAttrs (modDirVersionArg != null) { modDirVersion = modDirVersionArg; } # legacy diff --git a/pkgs/os-specific/linux/kernel/linux-5.15.nix b/pkgs/os-specific/linux/kernel/linux-5.15.nix index 8e07ff461ef..f72a304d30c 100644 --- a/pkgs/os-specific/linux/kernel/linux-5.15.nix +++ b/pkgs/os-specific/linux/kernel/linux-5.15.nix @@ -6,7 +6,7 @@ buildLinux (args // rec { version = "5.15.83"; # modDirVersion needs to be x.y.z, will automatically add .0 if needed - modDirVersion = if (modDirVersionArg == null) then concatStringsSep "." (take 3 (splitVersion "${version}.0")) else modDirVersionArg; + modDirVersion = versions.pad 3 version; # branchVersion needs to be x.y extraMeta.branch = versions.majorMinor version; @@ -16,3 +16,4 @@ buildLinux (args // rec { sha256 = "1wvzfhzqq9dps508wmp2gblfz93ipppnjzqm0n8pi1acq11hhna0"; }; } // (args.argsOverride or { })) + // lib.optionalAttrs (modDirVersionArg != null) { modDirVersion = modDirVersionArg; } # legacy diff --git a/pkgs/os-specific/linux/kernel/linux-5.4.nix b/pkgs/os-specific/linux/kernel/linux-5.4.nix index b45ef4f3b50..b41f18d400a 100644 --- a/pkgs/os-specific/linux/kernel/linux-5.4.nix +++ b/pkgs/os-specific/linux/kernel/linux-5.4.nix @@ -6,7 +6,7 @@ buildLinux (args // rec { version = "5.4.227"; # modDirVersion needs to be x.y.z, will automatically add .0 if needed - modDirVersion = if (modDirVersionArg == null) then concatStringsSep "." (take 3 (splitVersion "${version}.0")) else modDirVersionArg; + modDirVersion = versions.pad 3 version; # branchVersion needs to be x.y extraMeta.branch = versions.majorMinor version; @@ -16,3 +16,4 @@ buildLinux (args // rec { sha256 = "14q5gy48j78vwnqivrgpdhj778n2jq5l7yiw5na1rwqmfh1wbvsy"; }; } // (args.argsOverride or {})) + // lib.optionalAttrs (modDirVersionArg != null) { modDirVersion = modDirVersionArg; } # legacy diff --git a/pkgs/os-specific/linux/kernel/linux-6.0.nix b/pkgs/os-specific/linux/kernel/linux-6.0.nix index 2bd2a3f07c1..ea98462bdf4 100644 --- a/pkgs/os-specific/linux/kernel/linux-6.0.nix +++ b/pkgs/os-specific/linux/kernel/linux-6.0.nix @@ -6,7 +6,7 @@ buildLinux (args // rec { version = "6.0.13"; # modDirVersion needs to be x.y.z, will automatically add .0 if needed - modDirVersion = if (modDirVersionArg == null) then concatStringsSep "." (take 3 (splitVersion "${version}.0")) else modDirVersionArg; + modDirVersion = versions.pad 3 version; # branchVersion needs to be x.y extraMeta.branch = versions.majorMinor version; @@ -16,3 +16,4 @@ buildLinux (args // rec { sha256 = "191dlxcmbx8vy6z2k04jq2kr6hwnaknsnsyycvqnjmvmdf6i3lq8"; }; } // (args.argsOverride or { })) + // lib.optionalAttrs (modDirVersionArg != null) { modDirVersion = modDirVersionArg; } # legacy diff --git a/pkgs/os-specific/linux/kernel/linux-6.1.nix b/pkgs/os-specific/linux/kernel/linux-6.1.nix index 64ed1a717ca..aab12f77786 100644 --- a/pkgs/os-specific/linux/kernel/linux-6.1.nix +++ b/pkgs/os-specific/linux/kernel/linux-6.1.nix @@ -6,7 +6,7 @@ buildLinux (args // rec { version = "6.1"; # modDirVersion needs to be x.y.z, will automatically add .0 if needed - modDirVersion = if (modDirVersionArg == null) then concatStringsSep "." (take 3 (splitVersion "${version}.0")) else modDirVersionArg; + modDirVersion = versions.pad 3 version; # branchVersion needs to be x.y extraMeta.branch = versions.majorMinor version; @@ -16,3 +16,4 @@ buildLinux (args // rec { sha256 = "sha256-LKHxcFGkMPb+0RluSVJxdQcXGs/ZfZZXchJQJwOyXes="; }; } // (args.argsOverride or { })) + // lib.optionalAttrs (modDirVersionArg != null) { modDirVersion = modDirVersionArg; } # legacy diff --git a/pkgs/os-specific/linux/kernel/linux-rt-5.10.nix b/pkgs/os-specific/linux/kernel/linux-rt-5.10.nix index 103b142054a..a97b1acb5aa 100644 --- a/pkgs/os-specific/linux/kernel/linux-rt-5.10.nix +++ b/pkgs/os-specific/linux/kernel/linux-rt-5.10.nix @@ -13,8 +13,7 @@ in buildLinux (args // { inherit version; # modDirVersion needs a patch number, change X.Y-rtZ to X.Y.0-rtZ. - modDirVersion = if (builtins.match "[^.]*[.][^.]*-.*" version) == null then version - else lib.replaceStrings ["-"] [".0-"] version; + modDirVersion = lib.versions.pad 3 version; src = fetchurl { url = "mirror://kernel/linux/kernel/v5.x/linux-${kversion}.tar.xz"; diff --git a/pkgs/os-specific/linux/kernel/linux-testing.nix b/pkgs/os-specific/linux/kernel/linux-testing.nix index 76db1b11bbd..859df2c53e6 100644 --- a/pkgs/os-specific/linux/kernel/linux-testing.nix +++ b/pkgs/os-specific/linux/kernel/linux-testing.nix @@ -7,7 +7,7 @@ buildLinux (args // rec { extraMeta.branch = lib.versions.majorMinor version; # modDirVersion needs to be x.y.z, will always add .0 - modDirVersion = if (modDirVersionArg == null) then builtins.replaceStrings ["-"] [".0-"] version else modDirVersionArg; + modDirVersion = versions.pad 3 version; src = fetchurl { url = "https://git.kernel.org/torvalds/t/linux-${version}.tar.gz"; @@ -18,3 +18,4 @@ buildLinux (args // rec { extraMeta.hydraPlatforms = []; } // (args.argsOverride or {})) + // lib.optionalAttrs (modDirVersionArg != null) { modDirVersion = modDirVersionArg; } # legacy diff --git a/pkgs/os-specific/linux/kernel/manual-config.nix b/pkgs/os-specific/linux/kernel/manual-config.nix index edfd1f7dbc2..1ba5495fc90 100644 --- a/pkgs/os-specific/linux/kernel/manual-config.nix +++ b/pkgs/os-specific/linux/kernel/manual-config.nix @@ -22,8 +22,9 @@ in { pos ? null, # Additional kernel make flags extraMakeFlags ? [], - # The version of the kernel module directory - modDirVersion ? version, + # The name of the kernel module directory + # Needs to be X.Y.Z[-extra], so pad with zeros if needed. + modDirVersion ? lib.versions.pad 3 version, # The kernel source (tarball, git checkout, etc.) src, # a list of { name=..., patch=..., extraConfig=...} patches @@ -36,7 +37,7 @@ in { # Custom seed used for CONFIG_GCC_PLUGIN_RANDSTRUCT if enabled. This is # automatically extended with extra per-version and per-config values. randstructSeed ? "", - # Use defaultMeta // extraMeta + # Extra meta attributes extraMeta ? {}, # for module compatibility diff --git a/pkgs/os-specific/linux/kernel/xanmod-kernels.nix b/pkgs/os-specific/linux/kernel/xanmod-kernels.nix index cd1c8277807..42997b5302e 100644 --- a/pkgs/os-specific/linux/kernel/xanmod-kernels.nix +++ b/pkgs/os-specific/linux/kernel/xanmod-kernels.nix @@ -16,7 +16,7 @@ let xanmodKernelFor = { version, suffix ? "xanmod1", hash, variant }: buildLinux (args // rec { inherit version; - modDirVersion = "${version}-${suffix}"; + modDirVersion = lib.versions.pad 3 "${version}-${suffix}"; src = fetchFromGitHub { owner = "xanmod"; diff --git a/pkgs/os-specific/linux/kernel/zen-kernels.nix b/pkgs/os-specific/linux/kernel/zen-kernels.nix index a5878282847..08671e83ffc 100644 --- a/pkgs/os-specific/linux/kernel/zen-kernels.nix +++ b/pkgs/os-specific/linux/kernel/zen-kernels.nix @@ -18,7 +18,7 @@ let }; zenKernelsFor = { version, suffix, sha256, isLqx }: buildLinux (args // { inherit version; - modDirVersion = "${lib.concatStringsSep "." (lib.take 3 (lib.splitVersion version ++ [ "0" "0" ]))}-${suffix}"; + modDirVersion = lib.versions.pad 3 "${version}-${suffix}"; isZen = true; src = fetchFromGitHub { |