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 =
{ pkgs, lib, config, ... }:
let
nixBin = lib.getExe pkgs.nix;
flakeDir = config.homeManagerFlakeDir;
echoCmd = lib.getExe' pkgs.coreutils "echo";
hostnameCmd = "$(${lib.getExe pkgs.hostname} -s)";
@@ -31,10 +32,7 @@
};
};
config = let
nixBin = lib.getExe pkgs.nix;
in
{
config = {
home.activation.printFlakeDir = lib.hm.dag.entryAfter ["writeBoundary"] ''
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 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
'')
];
};
};