···11{ buildPackages
22, callPackage
33+, emptyFile
34, perl
45, bison ? null
56, flex ? null
···1516, nixosTests
1617}@args':
17181919+let overridableKernel =
1820lib.makeOverridable ({ # The kernel source tarball.
1921 src
2022···241243 + toString (lib.attrNames (lib.toFunction args { }))
242244 ) overridableKernel;
243245 };
244244- in [ (nixosTests.kernel-generic.passthru.testsForKernel overridableKernel) ] ++ kernelTests;
246246+ versionDoesNotDependOnPatchesEtc =
247247+ builtins.seq
248248+ (import ./generic.nix args' (args // (
249249+ let explain = attrName:
250250+ ''
251251+ The ${attrName} attribute must be able to access the kernel.version attribute without an infinite recursion.
252252+ That means that the kernel attrset (attrNames) and the kernel.version attribute must not depend on the ${attrName} argument.
253253+ The fact that this exception is raised shows that such a dependency does exist.
254254+ This is a problem for the configurability of ${attrName} in version-aware logic such as that in NixOS.
255255+ Strictness can creep in through optional attributes, or assertions and warnings that run as part of code that shouldn't access what is checked.
256256+ '';
257257+ in {
258258+ kernelPatches = throw (explain "kernelPatches");
259259+ structuredExtraConfig = throw (explain "structuredExtraConfig");
260260+ modDirVersion = throw (explain "modDirVersion");
261261+ }))).version
262262+ emptyFile;
263263+ in [
264264+ (nixosTests.kernel-generic.passthru.testsForKernel overridableKernel)
265265+ versionDoesNotDependOnPatchesEtc
266266+ ] ++ kernelTests;
245267 };
246268247247-}))
269269+}));
270270+in overridableKernel