2021-06-05 06:22:38 +00:00
|
|
|
callerInputs: hostsPath:
|
|
|
|
let
|
|
|
|
|
|
|
|
hostMetadata = builtins.mapAttrs
|
|
|
|
(name: _: import (hostsPath + "/${name}"))
|
|
|
|
(builtins.readDir hostsPath);
|
|
|
|
|
|
|
|
hardwareModules =
|
|
|
|
{
|
|
|
|
physical = (x: { imports = [ "${x.modulesPath}/installer/scan/not-detected.nix" ]; });
|
2021-07-13 14:55:27 +00:00
|
|
|
vmware = (x: {
|
|
|
|
virtualisation.vmware.guest.enable = true;
|
|
|
|
boot.initrd.availableKernelModules = [ "mptspi" ];
|
|
|
|
});
|
2021-06-05 06:22:38 +00:00
|
|
|
qemu = (x: {
|
|
|
|
services.qemuGuest.enable = true;
|
|
|
|
imports = [ "${x.modulesPath}/profiles/qemu-guest.nix" ];
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
getHostConfig = hostName: hostMeta:
|
|
|
|
callerInputs.${hostMeta.pkgs}.lib.nixosSystem
|
|
|
|
{
|
|
|
|
inherit (hostMeta) system;
|
|
|
|
modules = [
|
|
|
|
(callerInputs.self.nixosModule)
|
|
|
|
(hostMeta.module)
|
|
|
|
(hardwareModules.${hostMeta.hardware})
|
|
|
|
(_: { networking.hostName = hostName; })
|
2021-06-25 04:03:02 +00:00
|
|
|
(_: {
|
|
|
|
nixpkgs.overlays = [
|
|
|
|
(_: _: { unstable = callerInputs.unstable.legacyPackages.${hostMeta.system}; })
|
|
|
|
];
|
|
|
|
})
|
2021-06-05 06:22:38 +00:00
|
|
|
];
|
|
|
|
};
|
|
|
|
|
|
|
|
in
|
|
|
|
builtins.mapAttrs getHostConfig hostMetadata
|