1
0

Define host groups

This commit is contained in:
clerie 2023-04-21 23:03:11 +02:00
parent dcd8c37014
commit 7d13fb29d1
2 changed files with 17 additions and 3 deletions

View File

@ -15,9 +15,15 @@
helper = (import ./lib/flake-helper.nix) inputs; helper = (import ./lib/flake-helper.nix) inputs;
in { in {
clerie.hosts = { clerie.hosts = {
aluminium = { name = "aluminium"; }; aluminium = {
name = "aluminium";
group = "event";
};
backup-4 = { name = "backup-4"; }; backup-4 = { name = "backup-4"; };
beryllium = { name = "beryllium"; }; beryllium = {
name = "beryllium";
group = "event";
};
carbon = { name = "carbon"; }; carbon = { name = "carbon"; };
clerie-backup = { name = "clerie-backup"; }; clerie-backup = { name = "clerie-backup"; };
dn42-il-gw1 = { name = "dn42-il-gw1"; }; dn42-il-gw1 = { name = "dn42-il-gw1"; };
@ -37,7 +43,10 @@
storage-2 = { name = "storage-2"; }; storage-2 = { name = "storage-2"; };
web-2 = { name = "web-2"; }; web-2 = { name = "web-2"; };
dn42-ildix-service = { name = "dn42-ildix-service"; }; dn42-ildix-service = { name = "dn42-ildix-service"; };
astatine = { name = "astatine"; }; astatine = {
name = "astatine";
group = "event";
};
_iso = { name = "_iso"; }; _iso = { name = "_iso"; };
}; };

View File

@ -4,6 +4,7 @@ rec {
generateNixosSystem = { generateNixosSystem = {
name, name,
system ? "x86_64-linux", system ? "x86_64-linux",
group ? null,
}: let }: 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 {
@ -25,6 +26,7 @@ rec {
nixos-exporter; nixos-exporter;
}) })
]; ];
clerie.monitoring = nixpkgs.lib.attrsets.optionalAttrs (group != null) { serviceLevel = group; };
}) })
solid-xmpp-alarm.nixosModules.solid-xmpp-alarm solid-xmpp-alarm.nixosModules.solid-xmpp-alarm
(../hosts + "/${name}/configuration.nix") (../hosts + "/${name}/configuration.nix")
@ -37,6 +39,9 @@ rec {
deployment = { deployment = {
targetHost = "${name}.net.clerie.de"; targetHost = "${name}.net.clerie.de";
targetUser = null; targetUser = null;
tags = let
group = nixpkgs.lib.attrByPath [ "clerie" "monitoring" "serviceLevel" ] null hostSystem.config;
in nixpkgs.lib.lists.optional (group != null) group;
}; };
nixpkgs.system = hostSystem.config.nixpkgs.system; nixpkgs.system = hostSystem.config.nixpkgs.system;
imports = hostSystem._module.args.modules; imports = hostSystem._module.args.modules;