From e156b4ecafeeb1fd4e79514ad998ec1b79c54f53 Mon Sep 17 00:00:00 2001 From: Brendan Golden Date: Thu, 30 May 2024 13:56:40 +0100 Subject: [PATCH] feat: standardise restic (backups) to using ``services.skynet."${name}";`` format --- applications/dns.nix | 2 +- applications/email.nix | 2 +- applications/restic.nix | 9 +++++---- machines/agentjones.nix | 2 +- machines/cadie.nix | 2 +- machines/earth.nix | 2 +- machines/galatea.nix | 2 +- machines/gir.nix | 2 +- machines/glados.nix | 2 +- machines/kitt.nix | 2 +- machines/marvin.nix | 2 +- machines/neuromancer.nix | 2 +- machines/optimus.nix | 2 +- machines/skynet.nix | 2 +- machines/vendetta.nix | 2 +- machines/vigil.nix | 2 +- machines/wheatly.nix | 2 +- 17 files changed, 21 insertions(+), 20 deletions(-) diff --git a/applications/dns.nix b/applications/dns.nix index 5af8b46..a3e8a8b 100644 --- a/applications/dns.nix +++ b/applications/dns.nix @@ -342,7 +342,7 @@ in { }; config = lib.mkIf cfg.server.enable { - # services.skynet_backup.normal.backups = ["/etc/skynet/dns"]; + # services.skynet.backup.normal.backups = ["/etc/skynet/dns"]; # open the firewall for this skynet_firewall.forward = [ diff --git a/applications/email.nix b/applications/email.nix index 8831d14..d60e65f 100644 --- a/applications/email.nix +++ b/applications/email.nix @@ -198,7 +198,7 @@ in { }; config = mkIf cfg.enable { - services.skynet_backup.normal.backups = [ + services.skynet.backup.normal.backups = [ "/var/vmail" "/var/dkim" ]; diff --git a/applications/restic.nix b/applications/restic.nix index 4d6a277..09365c6 100644 --- a/applications/restic.nix +++ b/applications/restic.nix @@ -7,7 +7,8 @@ ... }: with lib; let - cfg = config.services.skynet_backup; + name = "backup"; + cfg = config.services.skynet."${name}"; enable_client = cfg.normal.backups != null && cfg.normal.backups != []; @@ -37,11 +38,11 @@ with lib; let ownServers = builtins.listToAttrs (builtins.concatLists ( lib.attrsets.mapAttrsToList ( key: value: let - backup = value.config.services.skynet_backup; + backup = value.config.services.skynet.backup; in if ( - (builtins.hasAttr "skynet_backup" value.config.services) + (builtins.hasAttr "backup" value.config.services.skynet) && backup.server.enable && backup.host.name != cfg.host.name && !backup.server.appendOnly @@ -85,7 +86,7 @@ in { # using https://github.com/greaka/ops/blob/818be4c4dea9129abe0f086d738df4cb0bb38288/apps/restic/options.nix as a base # https://git.hrnz.li/Ulli/nixos/src/commit/5edca2dfdab3ce52208e4dfd2b92951e500f8418/profiles/server/restic.nix # will eb enabled on every server - options.services.skynet_backup = { + options.services.skynet."${name}" = { # backup is enabled by default # enable = mkEnableOption "Skynet backup"; diff --git a/machines/agentjones.nix b/machines/agentjones.nix index 0c36db7..5748b53 100644 --- a/machines/agentjones.nix +++ b/machines/agentjones.nix @@ -45,7 +45,7 @@ in { } ]; - services.skynet_backup = { + services.skynet.backup = { host = { ip = ip_pub; name = name; diff --git a/machines/cadie.nix b/machines/cadie.nix index 73c6bf6..c9a8ed0 100644 --- a/machines/cadie.nix +++ b/machines/cadie.nix @@ -45,7 +45,7 @@ in { } ]; - services.skynet_backup = { + services.skynet.backup = { host = { ip = ip_pub; name = name; diff --git a/machines/earth.nix b/machines/earth.nix index 16dd17c..534ffcd 100644 --- a/machines/earth.nix +++ b/machines/earth.nix @@ -46,7 +46,7 @@ in { } ]; - services.skynet_backup = { + services.skynet.backup = { host = { ip = ip_pub; name = name; diff --git a/machines/galatea.nix b/machines/galatea.nix index e2c2574..3df97b5 100644 --- a/machines/galatea.nix +++ b/machines/galatea.nix @@ -46,7 +46,7 @@ in { } ]; - services.skynet_backup = { + services.skynet.backup = { host = { ip = ip_pub; name = name; diff --git a/machines/gir.nix b/machines/gir.nix index eaf1d17..c3dfb44 100644 --- a/machines/gir.nix +++ b/machines/gir.nix @@ -47,7 +47,7 @@ in { } ]; - services.skynet_backup = { + services.skynet.backup = { host = { ip = ip_pub; name = name; diff --git a/machines/glados.nix b/machines/glados.nix index 0b9a530..a6aa5dd 100644 --- a/machines/glados.nix +++ b/machines/glados.nix @@ -46,7 +46,7 @@ in { } ]; - services.skynet_backup = { + services.skynet.backup = { host = { ip = ip_pub; name = name; diff --git a/machines/kitt.nix b/machines/kitt.nix index b5c6c5e..4c39703 100644 --- a/machines/kitt.nix +++ b/machines/kitt.nix @@ -53,7 +53,7 @@ in { } ]; - services.skynet_backup = { + services.skynet.backup = { host = { ip = ip_pub; name = name; diff --git a/machines/marvin.nix b/machines/marvin.nix index 1f16c70..e44332f 100644 --- a/machines/marvin.nix +++ b/machines/marvin.nix @@ -63,7 +63,7 @@ in { } ]; - services.skynet_backup = { + services.skynet.backup = { host = { ip = ip_pub; name = name; diff --git a/machines/neuromancer.nix b/machines/neuromancer.nix index 4dc819f..323e859 100644 --- a/machines/neuromancer.nix +++ b/machines/neuromancer.nix @@ -58,7 +58,7 @@ in { } ]; - services.skynet_backup = { + services.skynet.backup = { server.enable = true; host = { ip = ip_pub; diff --git a/machines/optimus.nix b/machines/optimus.nix index c5290cb..3f44061 100644 --- a/machines/optimus.nix +++ b/machines/optimus.nix @@ -46,7 +46,7 @@ in { } ]; - services.skynet_backup = { + services.skynet.backup = { host = { ip = ip_pub; name = name; diff --git a/machines/skynet.nix b/machines/skynet.nix index 4cd0f05..5f1cb63 100644 --- a/machines/skynet.nix +++ b/machines/skynet.nix @@ -49,7 +49,7 @@ in { } ]; - services.skynet_backup.host = { + services.skynet.backup.host = { ip = ip_pub; name = name; }; diff --git a/machines/vendetta.nix b/machines/vendetta.nix index 0305baf..702b724 100644 --- a/machines/vendetta.nix +++ b/machines/vendetta.nix @@ -45,7 +45,7 @@ in { ]; }; - services.skynet_backup = { + services.skynet.backup = { host = { ip = ip_pub; name = name; diff --git a/machines/vigil.nix b/machines/vigil.nix index 0bda7ad..66abfb4 100644 --- a/machines/vigil.nix +++ b/machines/vigil.nix @@ -29,7 +29,7 @@ in { tags = ["active-dns" "dns"]; }; - services.skynet_backup = { + services.skynet.backup = { host = { ip = ip_pub; name = name; diff --git a/machines/wheatly.nix b/machines/wheatly.nix index 6b16cbc..835e0ac 100644 --- a/machines/wheatly.nix +++ b/machines/wheatly.nix @@ -45,7 +45,7 @@ in { } ]; - services.skynet_backup = { + services.skynet.backup = { host = { ip = ip_pub; name = name;