From 366733be87dd9e8e72c863bfc24d668f0e2b0172 Mon Sep 17 00:00:00 2001 From: Archit Gupta Date: Tue, 5 Dec 2023 00:38:45 -0800 Subject: [PATCH] Wrap NixOS build checks NixOS build checks significantly slowed down `nix flake show` as it prints out the derivation names, which for NixOS derivations requires a large amount of evaluation. By wrapping the derivations, we now give them trivial names. The NixOS configurations are still built when running checks as they are a dependency of the wrappers. --- builtinModules/nixosConfigurations.nix | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/builtinModules/nixosConfigurations.nix b/builtinModules/nixosConfigurations.nix index 49786d8..82d0756 100644 --- a/builtinModules/nixosConfigurations.nix +++ b/builtinModules/nixosConfigurations.nix @@ -32,8 +32,9 @@ in nixosConfigurations = configs; checks = foldl recursiveUpdate { } (mapAttrsToList (n: v: { - ${v.config.nixpkgs.system}."nixos-${n}" = - v.config.system.build.toplevel; + ${v.config.nixpkgs.system}."nixos-${n}" = v.pkgs.runCommand + "check-nixos-${n}" + { } "echo ${v.config.system.build.toplevel} > $out"; }) configs); };