variables
This commit is contained in:
@@ -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
|
||||||
'')
|
'')
|
||||||
|
|||||||
Reference in New Issue
Block a user