flake.nix: use more info from host-registry.nix

This commit is contained in:
Astro 2021-09-08 00:33:57 +02:00
parent 49e70e393a
commit 6ec7667c0a
2 changed files with 44 additions and 59 deletions

View File

@ -42,8 +42,19 @@
};
extraHostRegistry = import ./host-registry.nix;
hostRegistry = nixpkgs.lib.recursiveUpdate zwHostRegistry extraHostRegistry;
in {
flakifiedHosts = nixpkgs.lib.filterAttrs (_: { system ? null, ... }: system != null) hostRegistry.hosts;
getHostAddr = name:
let
hostConf = hostRegistry.hosts.${name};
in
if hostConf ? ip4
then hostConf.ip4
else if hostConf ? ip6
then hostConf.ip6
else null;
in {
overlay = import ./overlay;
legacyPackages = forAllSystems
@ -90,68 +101,28 @@
in {
inherit (pkgs) bmxd;
glotzbert-nixos-rebuild = mkDeploy { name = "glotzbert"; };
glotzbert-wake = mkWake "glotzbert";
} //
pulsebert-nixos-rebuild = mkDeploy {
name = "pulsebert";
builders = [ "ssh://client@172.22.99.110" ];
};
pulsebert-wake = mkWake "pulsebert";
builtins.foldl' (result: host: result // {
"${host}-wake" = mkWake host;
}) {} (builtins.attrNames (nixpkgs.lib.filterAttrs (_: { wol ? false, ... }: wol) hostRegistry.hosts)) //
yggdrasil-nixos-rebuild = mkDeploy {
name = "yggdrasil";
host = "172.20.72.62";
};
freifunk-nixos-rebuild = mkDeploy {
name = "freifunk";
host = "freifunk.core.zentralwerk.dn42";
};
matemat-nixos-rebuild = mkDeploy {
name = "matemat";
};
scrape-nixos-rebuild = mkDeploy {
name = "scrape";
host = hostRegistry.hosts.scrape.ip4;
};
dn42-nixos-rebuild = mkDeploy {
name = "dn42";
};
grafana-nixos-rebuild = mkDeploy {
name = "grafana";
};
hydra-nixos-rebuild = mkDeploy {
name = "hydra";
host = hostRegistry.hosts.hydra.ip4;
};
mucbot-nixos-rebuild = mkDeploy {
name = "mucbot";
host = hostRegistry.hosts.mucbot.ip4;
};
kibana-nixos-rebuild = mkDeploy {
name = "kibana";
host = hostRegistry.hosts.kibana.ip4;
};
public-access-proxy-nixos-rebuild = mkDeploy {
name = "public-access-proxy";
host = hostRegistry.hosts.public-access-proxy.ip4;
};
});
builtins.foldl' (result: name: result // {
"${name}-nixos-rebuild" = mkDeploy ({
inherit name;
host = getHostAddr name;
} // nixpkgs.lib.optionalAttrs (hostRegistry.hosts.${name} ? builders) {
inherit (hostRegistry.hosts.${name}) builders;
});
}) {} (builtins.attrNames flakifiedHosts)
);
nixosConfigurations = let
nixosSystem' =
# Our custom NixOS builder
{ extraArgs ? {}, ... }@args:
nixpkgs.lib.nixosSystem (args // {
#system = hostRegistry.${
extraArgs = extraArgs // {
inherit hostRegistry;
};

View File

@ -2,8 +2,6 @@
rec {
hosts = {
grafana.publicKey =
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPFB9fo01jzr2upEBEXiR7sSmeQoq9ll5Cf5/hjq5e4Y";
ledstripes.publicKey =
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHRwhszG9T8ZWuSRkAupCPi7YDQBdaX0YzoQSsvCSpzC";
@ -11,6 +9,8 @@ rec {
ether = "ec:a8:6b:fe:b4:cb";
publicKey =
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAnEWn/8CKIiCtehh6Ha3XUQqjODj0ygyo3aGAsFWgfG";
system = "x86_64-linux";
wol = true;
};
mpd-index = { };
@ -21,6 +21,9 @@ rec {
ether = "dc:a6:32:31:b6:32";
publicKey =
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIE9RKlt+mIew5epxHt7Gab44yFOdeD+L/EhhA6Ospzyq";
system = "aarch64-linux";
builders = [ "ssh://client@172.22.99.110" ];
wol = true;
};
samba = { };
storage-ng.publicKey =
@ -68,52 +71,63 @@ rec {
ygg = "201:4561:bb58:4dac:5f6a:7b23:44f:a5ef";
publicKey =
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHDmEymILp4IACjCbtMXx6eKPuTZHKyPUfAev05Gn7hi";
system = "x86_64-linux";
};
freifunk = {
ip4 = "172.20.72.40";
ip6 = "2a00:8180:2c00:281:8000::1";
publiKey =
publicKey =
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMFbxHGfBMBjjior1FNRub56O62K++HVnqUH67BeKD7d";
system = "x86_64-linux";
};
matemat = {
ip4 = "172.22.99.133";
ip6 = "2a00:8180:2c00:223:f82b:1bff:fedc:8572";
publicKey =
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBa07c4NnU1TGX1SMNea9e1d4nMtc0OS4gJLmTA3g/fe";
system = "x86_64-linux";
};
scrape = {
ip4 = "172.20.73.32";
ip6 = "2a00:8180:2c00:282:e073:50ff:fef5:eb6e";
publicKey =
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEGxPgg6nswoij1fBzDPDu6h4+d458XL2+dBxAx9KVOh";
system = "x86_64-linux";
};
dn42 = {
ip4 = "172.22.99.253";
system = "x86_64-linux";
};
grafana = {
ip6 = "2a00:8180:2c00:282:4042:fbff:fe4b:2de8";
publicKey =
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPFB9fo01jzr2upEBEXiR7sSmeQoq9ll5Cf5/hjq5e4Y";
system = "x86_64-linux";
};
hydra = {
ip4 = "172.20.73.49";
ip6 = "2a00:8180:2c00:282:e03c:d7ff:fe8e:fe16";
system = "x86_64-linux";
};
mucbot = {
ip4 = "172.20.73.27";
ip6 = "2a00:8180:2c00:282:28db:dff:fe6b:e89a";
system = "x86_64-linux";
};
kibana = {
ip4 = "172.20.73.44";
ip6 = "2a00:8180:2c00:282:460:7cff:fe28:76b2";
system = "x86_64-linux";
};
public-access-proxy = {
ip4 = "172.20.73.45";
ip6 = "2a00:8180:2c00:282:1024:5fff:febd:9be7";
system = "x86_64-linux";
};
};