mirror of
https://github.com/buckley310/nixos-config.git
synced 2024-11-09 18:47:02 +00:00
31 lines
869 B
Nix
31 lines
869 B
Nix
callerInputs: hostsPath:
|
|
let
|
|
|
|
hostMetadata = builtins.mapAttrs
|
|
(name: _: import (hostsPath + "/${name}"))
|
|
(builtins.readDir hostsPath);
|
|
|
|
hardwareModules =
|
|
{
|
|
physical = (x: { imports = [ "${x.modulesPath}/installer/scan/not-detected.nix" ]; });
|
|
vmware = (x: { virtualisation.vmware.guest.enable = true; });
|
|
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; })
|
|
];
|
|
};
|
|
|
|
in
|
|
builtins.mapAttrs getHostConfig hostMetadata
|