nixos-config/lib/hosts.nix
2021-10-04 01:48:11 -04:00

20 lines
464 B
Nix

{ path, nixosModule, ... }@inputs:
let
hostMetadata = builtins.mapAttrs
(name: _: import (path + "/${name}"))
(builtins.readDir path);
getHostConfig = hostName: hostMeta:
inputs.${hostMeta.pkgs}.lib.nixosSystem
{
inherit (hostMeta) system;
modules = [
(nixosModule)
(hostMeta.module)
(_: { networking.hostName = hostName; })
];
};
in
builtins.mapAttrs getHostConfig hostMetadata