initial support for multiple servers
This commit is contained in:
parent
a4a0e587c3
commit
397d6ab765
3 changed files with 32 additions and 14 deletions
|
@ -1,6 +1,10 @@
|
|||
{pkgs, ...}: {
|
||||
{
|
||||
pkgs,
|
||||
server,
|
||||
...
|
||||
}: {
|
||||
imports = [
|
||||
./hardware-configuration.nix
|
||||
server.hardware-configuration
|
||||
];
|
||||
|
||||
boot.loader = {
|
||||
|
|
38
flake.nix
38
flake.nix
|
@ -5,18 +5,32 @@
|
|||
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.05";
|
||||
};
|
||||
|
||||
outputs = {
|
||||
self,
|
||||
nixpkgs,
|
||||
...
|
||||
} @ attrs: {
|
||||
formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.alejandra;
|
||||
nixosConfigurations.jefke = nixpkgs.lib.nixosSystem {
|
||||
system = "x86_64-linux";
|
||||
specialArgs = attrs;
|
||||
modules = [
|
||||
./configuration.nix
|
||||
];
|
||||
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
|
||||
];
|
||||
}
|
||||
);
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue