nixos-config/lib/hosts.nix

21 lines
445 B
Nix
Raw Normal View History

2021-10-11 04:41:31 +00:00
{ path, nixpkgs, nixosModule }:
2021-06-05 06:22:38 +00:00
let
hostMetadata = builtins.mapAttrs
2021-08-23 00:42:09 +00:00
(name: _: import (path + "/${name}"))
(builtins.readDir path);
2021-06-05 06:22:38 +00:00
getHostConfig = hostName: hostMeta:
2021-10-11 04:41:31 +00:00
nixpkgs.lib.nixosSystem
2021-06-05 06:22:38 +00:00
{
inherit (hostMeta) system;
modules = [
2021-08-23 00:42:09 +00:00
(nixosModule)
2021-06-05 06:22:38 +00:00
(hostMeta.module)
(_: { networking.hostName = hostName; })
];
};
in
builtins.mapAttrs getHostConfig hostMetadata