diff --git a/modules/nix-tools/rebuild.nix b/modules/nix-tools/rebuild.nix index 7ce2735..27b2954 100644 --- a/modules/nix-tools/rebuild.nix +++ b/modules/nix-tools/rebuild.nix @@ -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 + '') ]; }; };