variables

This commit is contained in:
John Lancaster
2026-03-27 09:00:35 -05:00
parent 316f5f59a6
commit 9a05384ae5
+11 -3
View File
@@ -2,12 +2,20 @@
{ {
flake.modules.homeManager.rebuild = flake.modules.homeManager.rebuild =
{ pkgs, lib, config, ... }: { pkgs, lib, config, ... }:
let
hostnameCmd = "$(${lib.getExe pkgs.hostname} -s)";
in
{ {
options = { options = {
homeManagerFlakeDir = lib.mkOption { homeManagerFlakeDir = lib.mkOption {
description = "Path to the home-manager flake directory.";
type = lib.types.str; type = lib.types.str;
default = "${config.xdg.configHome}/home-manager"; 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" '' (writeShellScriptBin "flake-parts-check" ''
cd ${flakeDir} cd ${flakeDir}
${nixBin} run ".#write-flake" ${nixBin} run "${flakeDir}#write-flake"
${nixBin} flake check ${nixBin} flake check
'') '')
(writeShellScriptBin "nhms" '' (writeShellScriptBin "nhms" ''
HOSTNAME=$(hostname -s) HOSTNAME=${hostnameCmd}
echo "Switching to the $HOSTNAME profile" echo "Switching to the $HOSTNAME profile"
${lib.getExe home-manager} switch --impure --flake ${flakeDir}#$HOSTNAME ${lib.getExe home-manager} switch --impure --flake ${flakeDir}#$HOSTNAME
'') '')