nixos-config/lib/hosts.nix

31 lines
745 B
Nix
Raw Normal View History

2021-08-23 00:42:09 +00:00
{ path, nixosModule, unstable, ... }@inputs:
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-08-23 00:42:09 +00:00
inputs.${hostMeta.pkgs}.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; })
2021-06-25 04:03:02 +00:00
(_: {
nixpkgs.overlays = [
2021-09-10 14:20:02 +00:00
(_: _: {
unstable = import unstable {
inherit (hostMeta) system;
config.allowUnfree = true;
};
})
2021-06-25 04:03:02 +00:00
];
})
2021-06-05 06:22:38 +00:00
];
};
in
builtins.mapAttrs getHostConfig hostMetadata