nixpkgs/nixos/tests/kernel-generic.nix
Sergei Trofimovich db45ed3801 nixosTests.kernel-generic: fix the eval
Without the change the eval fails as:

    $ nix build --no-link -f. nixosTests.kernel-generic
    error:
       error: value is a Boolean while a set was expected

This started happening after 80472e3754 "treewide: add
__attrsFailEvaluation and __recurseIntoDerivationForReleaseJobs"

As a result kernel attribute set got not just `kernel => drv` maps but
also `__attrsFailEvaluation => bool` one. It does not contain `name` and
fails the evaluation without recovery.

The change restores evaluation for me.
2024-01-01 09:21:59 +00:00

51 lines
1.2 KiB
Nix

{ system ? builtins.currentSystem
, config ? { }
, pkgs ? import ../.. { inherit system config; }
}@args:
with pkgs.lib;
let
testsForLinuxPackages = linuxPackages: (import ./make-test-python.nix ({ pkgs, ... }: {
name = "kernel-${linuxPackages.kernel.version}";
meta = with pkgs.lib.maintainers; {
maintainers = [ nequissimus atemu ma27 ];
};
nodes.machine = { ... }:
{
boot.kernelPackages = linuxPackages;
};
testScript =
''
assert "Linux" in machine.succeed("uname -s")
assert "${linuxPackages.kernel.modDirVersion}" in machine.succeed("uname -a")
'';
}) args);
kernels = (removeAttrs pkgs.linuxKernel.vanillaPackages ["__attrsFailEvaluation"]) // {
inherit (pkgs.linuxKernel.packages)
linux_4_19_hardened
linux_5_4_hardened
linux_5_10_hardened
linux_5_15_hardened
linux_6_1_hardened
linux_6_5_hardened
linux_6_6_hardened
linux_rt_5_4
linux_rt_5_10
linux_rt_5_15
linux_rt_6_1
linux_libre
linux_testing;
};
in mapAttrs (_: lP: testsForLinuxPackages lP) kernels // {
passthru = {
inherit testsForLinuxPackages;
testsForKernel = kernel: testsForLinuxPackages (pkgs.linuxPackagesFor kernel);
};
}