nix-infra/helper.nix

26 lines
769 B
Nix
Raw Normal View History

2023-07-27 21:59:24 +02:00
{ nixpkgs, ... }@inputs:
rec {
generateNixosSystem = name: {
system ? "x86_64-linux",
group ? null,
modules ? [],
site
}: let
localNixpkgs = nixpkgs.lib.attrByPath [ "nixpkgs-${name}" ] nixpkgs inputs;
in localNixpkgs.lib.nixosSystem {
system = system;
modules = modules ++ [
./configuration/common
./configuration/proxmox-vm
./configuration/proxmox-vm/hardware-configuration.nix
./hosts/${name}
];
};
mapToNixosConfigurations = name: host: generateNixosSystem name host;
filterUnderscore = hosts: (nixpkgs.lib.filterAttrs (name: host: (builtins.substring 0 1 name) != "_") hosts);
buildHosts = hosts: builtins.mapAttrs (name: host: host.config.system.build.toplevel) (filterUnderscore hosts);
}