From ad7ef430e6f96c8ce90c255f4e06b7b4b9fe797d Mon Sep 17 00:00:00 2001 From: John Lancaster <32917998+jsl12@users.noreply.github.com> Date: Fri, 27 Mar 2026 19:37:20 -0500 Subject: [PATCH] added test-build --- modules/nix-tools/rebuild.nix | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) 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 + '') ]; }; };