From 9a05384ae52e8760290e80060a76faac05526640 Mon Sep 17 00:00:00 2001 From: John Lancaster <32917998+jsl12@users.noreply.github.com> Date: Fri, 27 Mar 2026 09:00:35 -0500 Subject: [PATCH] variables --- modules/nix-tools/rebuild.nix | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) 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 '')