diff options
author | Jan Tojnar <jtojnar@gmail.com> | 2024-04-28 17:32:03 +0200 |
---|---|---|
committer | Jan Tojnar <jtojnar@gmail.com> | 2024-04-28 17:33:27 +0200 |
commit | 1b2ebb8fbb35a20eb025078040f2e648bb317fe5 (patch) | |
tree | 477cb87ffc2468c8a41fa4e32e267bb440aacad9 /pkgs/os-specific | |
parent | 0e395f4da1693e39239ffac7abf73a0a6931c961 (diff) | |
parent | 2cf2f3a306f5ea1f0e184b4317c4d50679ec49b3 (diff) |
Merge branch 'master' into staging-next
Diffstat (limited to 'pkgs/os-specific')
-rw-r--r-- | pkgs/os-specific/linux/kernel/generic.nix | 52 | ||||
-rw-r--r-- | pkgs/os-specific/linux/kernel/kernels-org.json | 16 | ||||
-rw-r--r-- | pkgs/os-specific/linux/kernel/linux-rt-5.10.nix | 6 | ||||
-rw-r--r-- | pkgs/os-specific/linux/kernel/manual-config.nix | 9 |
4 files changed, 66 insertions, 17 deletions
diff --git a/pkgs/os-specific/linux/kernel/generic.nix b/pkgs/os-specific/linux/kernel/generic.nix index 77c6ee031956d..631217735d8fa 100644 --- a/pkgs/os-specific/linux/kernel/generic.nix +++ b/pkgs/os-specific/linux/kernel/generic.nix @@ -12,9 +12,13 @@ , rustc , rustPlatform , rust-bindgen +# testing +, emptyFile +, nixos , nixosTests }@args': +let overridableKernel = lib.makeOverridable ({ # The kernel source tarball. src @@ -211,11 +215,15 @@ let }; # end of configfile derivation kernel = (callPackage ./manual-config.nix { inherit lib stdenv buildPackages; }) (basicArgs // { - inherit kernelPatches randstructSeed extraMakeFlags extraMeta configfile; + inherit kernelPatches randstructSeed extraMakeFlags extraMeta configfile modDirVersion; pos = builtins.unsafeGetAttrPos "version" args; - config = { CONFIG_MODULES = "y"; CONFIG_FW_LOADER = "m"; } // lib.optionalAttrs withRust { CONFIG_RUST = "y"; }; - } // lib.optionalAttrs (modDirVersion != null) { inherit modDirVersion; }); + config = { + CONFIG_MODULES = "y"; + CONFIG_FW_LOADER = "m"; + CONFIG_RUST = lib.mkIf withRust "y"; + }; + }); in kernel.overrideAttrs (finalAttrs: previousAttrs: { @@ -241,7 +249,41 @@ kernel.overrideAttrs (finalAttrs: previousAttrs: { + toString (lib.attrNames (lib.toFunction args { })) ) overridableKernel; }; - in [ (nixosTests.kernel-generic.passthru.testsForKernel overridableKernel) ] ++ kernelTests; + /* Certain arguments must be evaluated lazily; so that only the output(s) depend on them. + Original reproducer / simplified use case: + */ + versionDoesNotDependOnPatchesEtcNixOS = + builtins.seq + (nixos ({ config, pkgs, ... }: { + boot.kernelPatches = [ + (builtins.seq config.boot.kernelPackages.kernel.version { patch = pkgs.emptyFile; }) + ]; + })).config.boot.kernelPackages.kernel.outPath + emptyFile; + versionDoesNotDependOnPatchesEtc = + builtins.seq + (import ./generic.nix args' (args // ( + let explain = attrName: + '' + The ${attrName} attribute must be able to access the kernel.version attribute without an infinite recursion. + That means that the kernel attrset (attrNames) and the kernel.version attribute must not depend on the ${attrName} argument. + The fact that this exception is raised shows that such a dependency does exist. + This is a problem for the configurability of ${attrName} in version-aware logic such as that in NixOS. + Strictness can creep in through optional attributes, or assertions and warnings that run as part of code that shouldn't access what is checked. + ''; + in { + kernelPatches = throw (explain "kernelPatches"); + structuredExtraConfig = throw (explain "structuredExtraConfig"); + modDirVersion = throw (explain "modDirVersion"); + }))).version + emptyFile; + in [ + (nixosTests.kernel-generic.passthru.testsForKernel overridableKernel) + versionDoesNotDependOnPatchesEtc + # Disabled by default, because the infinite recursion is hard to understand. The other test's error is better and produces a shorter trace. + # versionDoesNotDependOnPatchesEtcNixOS + ] ++ kernelTests; }; -})) +})); +in overridableKernel diff --git a/pkgs/os-specific/linux/kernel/kernels-org.json b/pkgs/os-specific/linux/kernel/kernels-org.json index 4ed2f457dba9f..19109c4efea8f 100644 --- a/pkgs/os-specific/linux/kernel/kernels-org.json +++ b/pkgs/os-specific/linux/kernel/kernels-org.json @@ -4,12 +4,12 @@ "hash": "sha256:1rk369sz6a4m1bm7zzxj8bpdma7rgybmx8frd54kp2l5mjp7brrp" }, "6.1": { - "version": "6.1.87", - "hash": "sha256:092iv5w5d6kwgiyzs7zajmhdxc1w03sinvvr1dwy9bp8f9mg2ypw" + "version": "6.1.88", + "hash": "sha256:1lgqclvcxfs5c4my6fh041gxzgzz8i64cw43cf5ichy58pyh4sb9" }, "5.15": { - "version": "5.15.156", - "hash": "sha256:0y3p7sqr8hsn0v9ybqlcmn1z150zc13yckgrymb10sck9k8na14z" + "version": "5.15.157", + "hash": "sha256:0554qxnai66mpm3p5dln9dfsb392zr8zvwfwc9ks2sadsd8j7wmg" }, "5.10": { "version": "5.10.215", @@ -24,11 +24,11 @@ "hash": "sha256:0jppa4p73pssd7m3jpc7i6rgnj9gawjcgk4wmqyy87ijzrgzm553" }, "6.6": { - "version": "6.6.28", - "hash": "sha256:151kdpp25fcl5qki138jxl90h9iyk5rk0kp2xamadnz72gnid1w1" + "version": "6.6.29", + "hash": "sha256:1l6bcz0pwiby6q79va063767d0jxkkaf8rpqvaqqcb08116gf9kz" }, "6.8": { - "version": "6.8.7", - "hash": "sha256:1bigq9my88d9xh647hgsy8gzval7p06hhacpxaqb71sfmwgil799" + "version": "6.8.8", + "hash": "sha256:1fiiyvwi6frn83z730w4mng2z4nwpspvhb6vjpxx3yk0snwxqk0w" } } 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 337594115fa6f..b013c7f1bf181 100644 --- a/pkgs/os-specific/linux/kernel/linux-rt-5.10.nix +++ b/pkgs/os-specific/linux/kernel/linux-rt-5.10.nix @@ -6,7 +6,7 @@ , ... } @ args: let - version = "5.10.213-rt105"; # updated by ./update-rt.sh + version = "5.10.215-rt107"; # updated by ./update-rt.sh branch = lib.versions.majorMinor version; kversion = builtins.elemAt (lib.splitString "-" version) 0; in buildLinux (args // { @@ -17,14 +17,14 @@ in buildLinux (args // { src = fetchurl { url = "mirror://kernel/linux/kernel/v5.x/linux-${kversion}.tar.xz"; - sha256 = "105df7w6m5a3fngi6ajqs5qblaq4lbxsgcppllrk7v1r68i31kw4"; + sha256 = "1af6h86flx96pszg006agpak2f9dkk2jqaazfykd7aafqdcs3747"; }; kernelPatches = let rt-patch = { name = "rt"; patch = fetchurl { url = "mirror://kernel/linux/kernel/projects/rt/${branch}/older/patch-${version}.patch.xz"; - sha256 = "1q5kz3mfvwb4fd5i2mbklsa6gifb8g3wbq0wi2478q097dvmb6gi"; + sha256 = "0lnnpnfmypafzfzhcmaxqqc18nna4fr236v6hrcyabnxmxam79xj"; }; }; in [ rt-patch ] ++ kernelPatches; diff --git a/pkgs/os-specific/linux/kernel/manual-config.nix b/pkgs/os-specific/linux/kernel/manual-config.nix index 5b222c4b45eff..cab04ad0c7d80 100644 --- a/pkgs/os-specific/linux/kernel/manual-config.nix +++ b/pkgs/os-specific/linux/kernel/manual-config.nix @@ -26,7 +26,7 @@ in lib.makeOverridable ({ extraMakeFlags ? [], # 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, + modDirVersion ? null /* derive from version */, # The kernel source (tarball, git checkout, etc.) src, # a list of { name=..., patch=..., extraConfig=...} patches @@ -54,6 +54,13 @@ in lib.makeOverridable ({ }: let + # Provide defaults. Note that we support `null` so that callers don't need to use optionalAttrs, + # which can lead to unnecessary strictness and infinite recursions. + modDirVersion_ = if modDirVersion == null then lib.versions.pad 3 version else modDirVersion; +in +let + # Shadow the un-defaulted parameter; don't want null. + modDirVersion = modDirVersion_; inherit (lib) hasAttr getAttr optional optionals optionalString optionalAttrs maintainers platforms; |