···1{ buildPackages
2, callPackage
3+, emptyFile
4, perl
5, bison ? null
6, flex ? null
···16, nixosTests
17}@args':
1819+let overridableKernel =
20lib.makeOverridable ({ # The kernel source tarball.
21 src
22···243 + toString (lib.attrNames (lib.toFunction args { }))
244 ) overridableKernel;
245 };
246+ versionDoesNotDependOnPatchesEtc =
247+ builtins.seq
248+ (import ./generic.nix args' (args // (
249+ let explain = attrName:
250+ ''
251+ The ${attrName} attribute must be able to access the kernel.version attribute without an infinite recursion.
252+ That means that the kernel attrset (attrNames) and the kernel.version attribute must not depend on the ${attrName} argument.
253+ The fact that this exception is raised shows that such a dependency does exist.
254+ This is a problem for the configurability of ${attrName} in version-aware logic such as that in NixOS.
255+ Strictness can creep in through optional attributes, or assertions and warnings that run as part of code that shouldn't access what is checked.
256+ '';
257+ in {
258+ kernelPatches = throw (explain "kernelPatches");
259+ structuredExtraConfig = throw (explain "structuredExtraConfig");
260+ modDirVersion = throw (explain "modDirVersion");
261+ }))).version
262+ emptyFile;
263+ in [
264+ (nixosTests.kernel-generic.passthru.testsForKernel overridableKernel)
265+ versionDoesNotDependOnPatchesEtc
266+ ] ++ kernelTests;
267 };
268269+}));
270+in overridableKernel