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
|
|
|
|
|
|
|
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:
|
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)
|
|
|
|
(hardwareModules.${hostMeta.hardware})
|
|
|
|
(_: { networking.hostName = hostName; })
|
2021-06-25 04:03:02 +00:00
|
|
|
(_: {
|
|
|
|
nixpkgs.overlays = [
|
2021-08-23 00:42:09 +00:00
|
|
|
(_: _: { unstable = unstable.legacyPackages.${hostMeta.system}; })
|
2021-06-25 04:03:02 +00:00
|
|
|
];
|
|
|
|
})
|
2021-06-05 06:22:38 +00:00
|
|
|
];
|
|
|
|
};
|
|
|
|
|
|
|
|
in
|
|
|
|
builtins.mapAttrs getHostConfig hostMetadata
|