about summary refs log tree commit diff
path: root/modules/core
diff options
context:
space:
mode:
authorsternenseemann <0rpkxez4ksa01gb3typccl0i@systemli.org>2021-04-13 11:15:15 +0200
committersternenseemann <0rpkxez4ksa01gb3typccl0i@systemli.org>2021-04-13 11:15:15 +0200
commit0f199c27f3ed33feacc83dc57a40667e4cb32795 (patch)
treef0eb28c8579e50311a5a5d44088e07f0e7cfcf88 /modules/core
parenta799173a031f2acbfaf2b6b6955c7c8288a16c70 (diff)
modules/core/tests: adjust for new kernel test structure
The kernel-lts and kernel-latest tests seem to have been removed (not
sure when exactly, didn't blame). Instead we can use
nixosTests.kernel-generic."linux_${major}_${minor}". This allows us to
easily check for tests for arbitrary kernel versions as well.

However there is currently a bug that these are returned as functions
instead of derivations at the moment which will hopefully be fixed by my
upstream PR soon. Until that happens we check if the test is a
derivation or not with lib.isDerivation.

cc @aszlig for comments / further improvements. Main intention right now
is to fix eval in a future proof way.
Diffstat (limited to 'modules/core')
-rw-r--r--modules/core/tests.nix24
1 files changed, 12 insertions, 12 deletions
diff --git a/modules/core/tests.nix b/modules/core/tests.nix
index 9a70041c..17061fff 100644
--- a/modules/core/tests.nix
+++ b/modules/core/tests.nix
@@ -370,18 +370,18 @@ let
       in !isHeimdal && (isServer || config.krb5.enable);
       path  = ["nixos" "kerberos" "mit"];
     }
-    { check = config.boot.kernelPackages.kernel.version
-           == pkgs.linuxPackages_latest.kernel.version;
-      path  = ["nixos" "kernel-latest"];
-    }
-    { check = config.boot.kernelPackages.kernel.version
-           == pkgs.linuxPackages.kernel.version;
-      path  = ["nixos" "kernel-lts"];
-    }
-    { check = config.boot.kernelPackages.kernel.version
-           == pkgs.linuxPackages_testing.kernel.version;
-      path  = ["nixos" "kernel-testing"];
-    }
+    (let
+      kernelVersion = config.boot.kernelPackages.kernel.version;
+      majorMinor = lib.concatStringsSep "_"
+        (lib.take 2 (builtins.splitVersion kernelVersion));
+      kernelTestName = "linux_${majorMinor}";
+    in {
+      # isDerivation is a workaround to fix eval until
+      # https://github.com/NixOS/nixpkgs/pull/119307 lands.
+      check = lib.isDerivation
+        (pkgs.nixosTests.kernel-generic."${kernelTestName}" or null);
+      path  = ["nixos" "kernel-generic" kernelTestName ];
+    })
     { check = config.services.knot.enable;
       path  = ["nixos" "knot"];
     }