1
0

flake.nix: Support different system types

This commit is contained in:
clerie 2023-04-16 16:37:11 +02:00
parent 4b8a678873
commit 4ab025cdad
2 changed files with 34 additions and 30 deletions

View File

@ -14,36 +14,35 @@
outputs = { self, nixpkgs, nixos-exporter, solid-xmpp-alarm, ... }@inputs: let outputs = { self, nixpkgs, nixos-exporter, solid-xmpp-alarm, ... }@inputs: let
helper = (import ./lib/flake-helper.nix) inputs; helper = (import ./lib/flake-helper.nix) inputs;
in { in {
nixosConfigurations = let clerie.hosts = {
inherit (helper) aluminium = { name = "aluminium"; };
generateNixosSystem; backup-4 = { name = "backup-4"; };
in { beryllium = { name = "beryllium"; };
aluminium = generateNixosSystem "aluminium"; carbon = { name = "carbon"; };
backup-4 = generateNixosSystem "backup-4"; clerie-backup = { name = "clerie-backup"; };
beryllium = generateNixosSystem "beryllium"; dn42-il-gw1 = { name = "dn42-il-gw1"; };
carbon = generateNixosSystem "carbon"; dn42-il-gw5 = { name = "dn42-il-gw5"; };
clerie-backup = generateNixosSystem "clerie-backup"; dn42-il-gw6 = { name = "dn42-il-gw6"; };
dn42-il-gw1 = generateNixosSystem "dn42-il-gw1"; dn42-ildix-clerie = { name = "dn42-ildix-clerie"; };
dn42-il-gw5 = generateNixosSystem "dn42-il-gw5"; gatekeeper = { name = "gatekeeper"; };
dn42-il-gw6 = generateNixosSystem "dn42-il-gw6"; hydra-1 = { name = "hydra-1"; };
dn42-ildix-clerie = generateNixosSystem "dn42-ildix-clerie"; hydra-2 = { name = "hydra-2"; };
gatekeeper = generateNixosSystem "gatekeeper"; minecraft-2 = { name = "minecraft-2"; };
hydra-1 = generateNixosSystem "hydra-1"; monitoring-3 = { name = "monitoring-3"; };
hydra-2 = generateNixosSystem "hydra-2"; nonat = { name = "nonat"; };
minecraft-2 = generateNixosSystem "minecraft-2"; osmium = { name = "osmium"; };
monitoring-3 = generateNixosSystem "monitoring-3"; palladium = { name = "palladium"; };
nonat = generateNixosSystem "nonat"; porter = { name = "porter"; };
osmium = generateNixosSystem "osmium"; schule = { name = "schule"; };
palladium = generateNixosSystem "palladium"; storage-2 = { name = "storage-2"; };
porter = generateNixosSystem "porter"; web-2 = { name = "web-2"; };
schule = generateNixosSystem "schule"; dn42-ildix-service = { name = "dn42-ildix-service"; };
storage-2 = generateNixosSystem "storage-2"; astatine = { name = "astatine"; };
web-2 = generateNixosSystem "web-2"; _iso = { name = "_iso"; };
dn42-ildix-service = generateNixosSystem "dn42-ildix-service";
astatine = generateNixosSystem "astatine";
_iso = generateNixosSystem "_iso";
}; };
nixosConfigurations = helper.mapToNixosConfigurations self.clerie.hosts;
colmena = { colmena = {
meta = { meta = {
nixpkgs = import nixpkgs {}; nixpkgs = import nixpkgs {};

View File

@ -1,10 +1,13 @@
{ self, nixpkgs, nixos-exporter, solid-xmpp-alarm, ... }@inputs: { self, nixpkgs, nixos-exporter, solid-xmpp-alarm, ... }@inputs:
rec { rec {
generateNixosSystem = name: let generateNixosSystem = {
name,
system ? "x86_64-linux",
}: let
localNixpkgs = nixpkgs.lib.attrByPath [ "nixpkgs-${name}" ] nixpkgs inputs; localNixpkgs = nixpkgs.lib.attrByPath [ "nixpkgs-${name}" ] nixpkgs inputs;
in localNixpkgs.lib.nixosSystem { in localNixpkgs.lib.nixosSystem {
system = "x86_64-linux"; system = system;
modules = [ modules = [
({ ... }: { ({ ... }: {
/* /*
@ -28,6 +31,8 @@ rec {
]; ];
}; };
mapToNixosConfigurations = hosts: builtins.mapAttrs (name: host: generateNixosSystem host) hosts;
generateColmenaHost = name: hostSystem: { generateColmenaHost = name: hostSystem: {
deployment = { deployment = {
targetHost = "${name}.net.clerie.de"; targetHost = "${name}.net.clerie.de";