nixos-servers/flake.nix

36 lines
955 B
Nix

{
description = "NixOS definitions for our physical servers";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.05";
};
outputs = {nixpkgs, ...}: let
servers = {
jefke = {
hardware-configuration = import ./hardware-configuration/jefke.nix;
system-arch = "x86_64-linux";
};
};
serverNames = builtins.attrNames servers;
serverWithNameAttr = name: (builtins.getAttr name servers) // {name = name;};
genNixosConfigurations = config:
nixpkgs.lib.genAttrs serverNames (
serverName:
nixpkgs.lib.nixosSystem (config (serverWithNameAttr serverName))
);
in {
formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.alejandra;
nixosConfigurations = genNixosConfigurations (
server: {
system = server.system-arch;
specialArgs = {inherit server;};
modules = [
./configuration.nix
];
}
);
};
}