diff options
| author | seth <[email protected]> | 2023-04-17 12:00:55 -0400 |
|---|---|---|
| committer | seth <[email protected]> | 2023-04-17 12:01:21 -0400 |
| commit | 92ca826539092f33c8e19a19c7a9ea0def2aece0 (patch) | |
| tree | c6ff98c3f645f189b559bc1a69904fec217a946c /lib/host.nix | |
| parent | 98921a299be9f22bde9204e1fd05d0ea0fb0c6ed (diff) | |
move most configurations to modules
Diffstat (limited to 'lib/host.nix')
| -rw-r--r-- | lib/host.nix | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/lib/host.nix b/lib/host.nix new file mode 100644 index 0000000..b5e00b3 --- /dev/null +++ b/lib/host.nix @@ -0,0 +1,49 @@ +{ + inputs, + mapFilterDirs, +}: rec { + mkHost = { + name, + modules, + specialArgs ? {}, + system ? "x86_64-linux", + stateVersion ? "22.11", + pkgs, + }: + with pkgs.lib; + nixosSystem { + inherit system specialArgs; + modules = + [ + ../modules + ../hosts/${name} + + { + system.stateVersion = stateVersion; + networking.hostName = mkDefault name; + + nixpkgs = { + overlays = with inputs; [nur.overlay getchoo.overlays.default]; + config.allowUnfree = true; + }; + nix.registry.getchoo.flake = inputs.getchoo; + + nixos.enable = true; + } + ] + ++ modules; + }; + + mapHosts = inputs: let + hosts = import ../hosts inputs; + in + mapFilterDirs ../hosts (n: v: v == "directory" && n != "turret") (name: _: + mkHost { + inherit name; + inherit (hosts.${name}) modules system stateVersion pkgs; + specialArgs = + if builtins.hasAttr "specialArgs" hosts.${name} + then hosts.${name}.specialArgs + else {}; + }); +} |
