fix(shell)!: accept a hostname parameter

Pass along device `hostname` into `home-manager` (and more) configs
Used for the `rebuild` command since `nix-on-droid` uses the `default` system instead of the `$(hostname)` one (because that requires root to change on-device)
This commit is contained in:
reo101 2023-07-26 09:43:14 +03:00
parent bc81e59950
commit 20e7547b0c
Signed by: reo101
GPG key ID: 675AA7EF13964ACB
4 changed files with 45 additions and 120 deletions

View file

@ -3,8 +3,6 @@
let
inherit (inputs) nixpkgs;
inherit (nixpkgs) lib;
inherit (lib) mapAttrs;
inherit (lib.attrsets) filterAttrs;
in
rec {
# Boolean helpers
@ -14,7 +12,7 @@ rec {
# Directory walking helpers
recurseDir = dir:
mapAttrs
lib.mapAttrs
(file: type:
if type == "directory"
then recurseDir "${dir}/${file}"
@ -131,6 +129,7 @@ rec {
sharedModules = builtins.attrValues homeManagerModules;
extraSpecialArgs = {
inherit inputs outputs;
inherit hostname;
};
};
}
@ -163,13 +162,17 @@ rec {
useGlobalPkgs = false;
useUserPackages = true;
sharedModules = builtins.attrValues homeManagerModules;
extraSpecialArgs = { inherit inputs outputs; };
extraSpecialArgs = {
inherit inputs outputs;
inherit hostname;
};
};
}
] ++ (builtins.attrValues nixOnDroidModules);
extraSpecialArgs = {
inherit inputs outputs;
inherit hostname;
# rootPath = ./.;
};
@ -190,12 +193,18 @@ rec {
users
(user: import (root + "/home/${user}.nix"));
sharedModules = builtins.attrValues homeManagerModules;
extraSpecialArgs = { inherit inputs outputs; };
extraSpecialArgs = {
inherit inputs outputs;
inherit hostname;
};
};
}
] ++ (builtins.attrValues nixDarwinModules);
inputs = { inherit inputs outputs nixpkgs; };
inputs = {
inherit inputs outputs;
inherit nixpkgs;
};
};
mkHomeManagerHost = root: system: hostname: inputs.home-manager.lib.homeManagerConfiguration {
@ -205,7 +214,10 @@ rec {
(root + "/home.nix")
] ++ (builtins.attrValues homeManagerModules);
extraSpecialArgs = { inherit inputs outputs; };
extraSpecialArgs = {
inherit inputs outputs;
inherit hostname;
};
};
createConfigurations =