kernel/generic: add kernelTests automatically

Unfortunately, there seems to be no way of referencing an overridable version of
the package you're in, so it had to be stubed to work at all.

This isn't important for our current, very basic kernel nixosTests but might
become important when we add more sophisticated ones.
This commit is contained in:
Atemu 2021-05-02 15:46:34 +02:00
parent a3f6ff6d48
commit 0a43b6d5e9

@ -58,6 +58,7 @@
, preferBuiltin ? stdenv.hostPlatform.linux-kernel.preferBuiltin or false
, kernelArch ? stdenv.hostPlatform.linuxArch
, kernelTests ? []
, nixosTests
, ...
}:
@ -192,7 +193,16 @@ let
kernelOlder = lib.versionOlder version;
kernelAtLeast = lib.versionAtLeast version;
passthru = kernel.passthru // (removeAttrs passthru [ "passthru" ]);
tests = kernelTests;
tests = let
overridableKernel = finalKernel // {
override = args:
lib.warn (
"override is stubbed for NixOS kernel tests, not applying changes these arguments: "
+ toString (lib.attrNames (if lib.isAttrs args then args else args {}))
) overridableKernel;
};
in [ (nixosTests.kernel-generic.testsForKernel overridableKernel) ] ++ kernelTests;
};
in lib.extendDerivation true passthru kernel
finalKernel = lib.extendDerivation true passthru kernel;
in finalKernel