diff --git a/modules/nix-tools/rebuild.nix b/modules/nix-tools/rebuild.nix index 8ef00c5..772ec5b 100644 --- a/modules/nix-tools/rebuild.nix +++ b/modules/nix-tools/rebuild.nix @@ -2,12 +2,20 @@ { flake.modules.homeManager.rebuild = { pkgs, lib, config, ... }: + let + hostnameCmd = "$(${lib.getExe pkgs.hostname} -s)"; + in { options = { homeManagerFlakeDir = lib.mkOption { + description = "Path to the home-manager flake directory."; type = lib.types.str; default = "${config.xdg.configHome}/home-manager"; - description = "Path to the home-manager flake directory."; + }; + buildHostname = lib.mkOption { + description = "Hostname for the NixOS configuration to use."; + type = lib.types.str; + default = hostnameCmd; }; }; @@ -27,11 +35,11 @@ '') (writeShellScriptBin "flake-parts-check" '' cd ${flakeDir} - ${nixBin} run ".#write-flake" + ${nixBin} run "${flakeDir}#write-flake" ${nixBin} flake check '') (writeShellScriptBin "nhms" '' - HOSTNAME=$(hostname -s) + HOSTNAME=${hostnameCmd} echo "Switching to the $HOSTNAME profile" ${lib.getExe home-manager} switch --impure --flake ${flakeDir}#$HOSTNAME '')