added test-build

This commit is contained in:
John Lancaster
2026-03-27 19:37:20 -05:00
parent 00c4cf5289
commit ad7ef430e6
+12 -5
View File
@@ -1,8 +1,9 @@
{ inputs, ... }: { self, inputs, ... }:
{ {
flake.modules.homeManager.rebuild = flake.modules.homeManager.rebuild =
{ pkgs, lib, config, ... }: { pkgs, lib, config, ... }:
let let
nixBin = lib.getExe pkgs.nix;
flakeDir = config.homeManagerFlakeDir; flakeDir = config.homeManagerFlakeDir;
echoCmd = lib.getExe' pkgs.coreutils "echo"; echoCmd = lib.getExe' pkgs.coreutils "echo";
hostnameCmd = "$(${lib.getExe pkgs.hostname} -s)"; hostnameCmd = "$(${lib.getExe pkgs.hostname} -s)";
@@ -31,10 +32,7 @@
}; };
}; };
config = let config = {
nixBin = lib.getExe pkgs.nix;
in
{
home.activation.printFlakeDir = lib.hm.dag.entryAfter ["writeBoundary"] '' home.activation.printFlakeDir = lib.hm.dag.entryAfter ["writeBoundary"] ''
run ${echoCmd} "Home Manager flake directory: ${flakeDir}" run ${echoCmd} "Home Manager flake directory: ${flakeDir}"
''; '';
@@ -69,6 +67,15 @@
${lib.getExe git} -C ${flakeDir} add ${flakeDir}/flake.lock > /dev/null 2>&1 ${lib.getExe git} -C ${flakeDir} add ${flakeDir}/flake.lock > /dev/null 2>&1
${lib.getExe nfs} ${lib.getExe nfs}
'') '')
(writeShellScriptBin "test-build" ''
if [ -z "$1" ]; then
HOSTNAME=${hostnameCmd}
else
HOSTNAME="$1"
fi
${echoCmd} "Testing the evaulation of the nixos config for $HOSTNAME"
${nixBin} eval ${flakeDir}#nixosConfigurations.$HOSTNAME.config.system.build.toplevel.drvPath
'')
]; ];
}; };
}; };