about summary refs log tree commit diff
path: root/flake.nix
diff options
context:
space:
mode:
authorr-vdp <ramses@well-founded.dev>2023-12-29 01:08:45 +0100
committerr-vdp <ramses@well-founded.dev>2023-12-29 01:17:03 +0100
commitf8c13ee878f11af512787c747ce2e600490475df (patch)
tree26fd73eba91cc35d0d18f9a8e8f14ab8fdda3e28 /flake.nix
parent981754ba5ce433b872c71a901e7d1979b07415ab (diff)
flake: add a test case for the nixosSystem to the flake checks
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix20
1 files changed, 19 insertions, 1 deletions
diff --git a/flake.nix b/flake.nix
index ff04e6b972d86..6fc0d4f879328 100644
--- a/flake.nix
+++ b/flake.nix
@@ -31,7 +31,25 @@
           );
       });
 
-      checks.x86_64-linux.tarball = jobs.tarball;
+      checks.x86_64-linux = {
+        tarball = jobs.tarball;
+        # Test that ensures that the nixosSystem function can accept a lib argument
+        nixosSystemAcceptsLib = (self.lib.nixosSystem {
+          lib = self.lib.extend (final: prev: {
+            ifThisFunctionIsMissingTheTestFails = final.id;
+          });
+          modules = [
+            ./nixos/modules/profiles/minimal.nix
+            ({ lib, ... }: lib.ifThisFunctionIsMissingTheTestFails {
+              # Define a minimal config without eval warnings
+              nixpkgs.hostPlatform = "x86_64-linux";
+              boot.loader.grub.enable = false;
+              fileSystems."/".device = "nodev";
+              system.stateVersion = lib.versions.majorMinor lib.version;
+            })
+          ];
+        }).config.system.build.toplevel;
+      };
 
       htmlDocs = {
         nixpkgsManual = jobs.manual;