feat: make nh host selection automatic

This commit is contained in:
2026-10-17 00:01:06 +09:00
parent 1d88eb19f0
commit d85957eeed
3 changed files with 10 additions and 3 deletions
+2 -2
View File
@@ -11,7 +11,7 @@ nix run .#home-manager -- switch --flake .#<username>@<host>
`nh` 導入後:
```
nh os switch -H <host>
nh os switch
nh home switch -c <username>@<host>
nh home switch
```
+6 -1
View File
@@ -5,6 +5,11 @@ rec {
x1carbon = import ./x1carbon inputs;
fungus = import ./fungus inputs;
};
nixos = builtins.mapAttrs (_: host: host.nixos) hosts;
nixos = builtins.listToAttrs (
map (host: {
name = host.hostname;
value = host.nixos;
}) (builtins.attrValues hosts)
);
home-manager = builtins.foldl' (a: b: a // b) { } (map (h: h.home-manager) (builtins.attrValues hosts));
}
+2
View File
@@ -12,6 +12,8 @@ let
};
in
{
inherit hostname;
nixos = inputs.nixpkgs.lib.nixosSystem {
modules =
systemModules