2021-06-02 20:46:32 +00:00
|
|
|
{ modules, nixpkgs, unstable }:
|
2021-04-06 03:11:17 +00:00
|
|
|
let
|
2021-04-06 03:24:24 +00:00
|
|
|
|
2021-04-10 16:55:17 +00:00
|
|
|
hostMetadata =
|
|
|
|
let
|
2021-04-11 20:41:49 +00:00
|
|
|
fs = builtins.readDir ./.;
|
|
|
|
inherit (builtins) concatMap attrNames;
|
2021-04-10 16:55:17 +00:00
|
|
|
hostNames = concatMap (x: if fs.${x} == "directory" then [ x ] else [ ]) (attrNames fs);
|
|
|
|
in
|
2021-04-11 20:41:49 +00:00
|
|
|
builtins.listToAttrs (map
|
|
|
|
(hn: { name = hn; value = import (./. + "/${hn}"); })
|
|
|
|
hostNames);
|
2021-04-06 03:24:24 +00:00
|
|
|
|
2021-04-11 20:41:49 +00:00
|
|
|
hardwareModule = hardware: (
|
2021-04-10 16:55:17 +00:00
|
|
|
{
|
|
|
|
qemu = (x: { imports = [ "${x.modulesPath}/profiles/qemu-guest.nix" ]; });
|
2021-04-11 20:41:49 +00:00
|
|
|
physical = (x: { imports = [ "${x.modulesPath}/installer/scan/not-detected.nix" ]; });
|
2021-04-10 16:55:17 +00:00
|
|
|
}
|
|
|
|
).${hardware};
|
2021-04-06 03:11:17 +00:00
|
|
|
|
|
|
|
in
|
2021-04-11 20:41:49 +00:00
|
|
|
builtins.mapAttrs
|
|
|
|
(n: v:
|
2021-06-02 20:46:32 +00:00
|
|
|
let pkgs = { inherit nixpkgs unstable; }.${v.pkgs};
|
2021-04-11 20:41:49 +00:00
|
|
|
in
|
|
|
|
pkgs.lib.nixosSystem {
|
|
|
|
inherit (v) system;
|
2021-04-13 00:42:45 +00:00
|
|
|
modules = modules ++ [
|
2021-04-11 20:41:49 +00:00
|
|
|
(./. + "/${n}/configuration.nix")
|
|
|
|
(hardwareModule v.hardware)
|
2021-05-28 20:16:28 +00:00
|
|
|
({ ... }: { networking.hostName = n; })
|
2021-04-11 20:41:49 +00:00
|
|
|
];
|
|
|
|
}
|
|
|
|
)
|
|
|
|
hostMetadata
|