feat: standardise restic (backups) to using `services.skynet."${name}";` format

This commit is contained in:
silver 2024-05-30 13:56:40 +01:00
parent 73a9419798
commit e156b4ecaf
Signed by: silver
GPG key ID: 54E2C71918E93B74
17 changed files with 21 additions and 20 deletions

View file

@ -342,7 +342,7 @@ in {
}; };
config = lib.mkIf cfg.server.enable { 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 # open the firewall for this
skynet_firewall.forward = [ skynet_firewall.forward = [

View file

@ -198,7 +198,7 @@ in {
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
services.skynet_backup.normal.backups = [ services.skynet.backup.normal.backups = [
"/var/vmail" "/var/vmail"
"/var/dkim" "/var/dkim"
]; ];

View file

@ -7,7 +7,8 @@
... ...
}: }:
with lib; let with lib; let
cfg = config.services.skynet_backup; name = "backup";
cfg = config.services.skynet."${name}";
enable_client = cfg.normal.backups != null && cfg.normal.backups != []; enable_client = cfg.normal.backups != null && cfg.normal.backups != [];
@ -37,11 +38,11 @@ with lib; let
ownServers = builtins.listToAttrs (builtins.concatLists ( ownServers = builtins.listToAttrs (builtins.concatLists (
lib.attrsets.mapAttrsToList ( lib.attrsets.mapAttrsToList (
key: value: let key: value: let
backup = value.config.services.skynet_backup; backup = value.config.services.skynet.backup;
in in
if if
( (
(builtins.hasAttr "skynet_backup" value.config.services) (builtins.hasAttr "backup" value.config.services.skynet)
&& backup.server.enable && backup.server.enable
&& backup.host.name != cfg.host.name && backup.host.name != cfg.host.name
&& !backup.server.appendOnly && !backup.server.appendOnly
@ -85,7 +86,7 @@ in {
# using https://github.com/greaka/ops/blob/818be4c4dea9129abe0f086d738df4cb0bb38288/apps/restic/options.nix as a base # 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 # https://git.hrnz.li/Ulli/nixos/src/commit/5edca2dfdab3ce52208e4dfd2b92951e500f8418/profiles/server/restic.nix
# will eb enabled on every server # will eb enabled on every server
options.services.skynet_backup = { options.services.skynet."${name}" = {
# backup is enabled by default # backup is enabled by default
# enable = mkEnableOption "Skynet backup"; # enable = mkEnableOption "Skynet backup";

View file

@ -45,7 +45,7 @@ in {
} }
]; ];
services.skynet_backup = { services.skynet.backup = {
host = { host = {
ip = ip_pub; ip = ip_pub;
name = name; name = name;

View file

@ -45,7 +45,7 @@ in {
} }
]; ];
services.skynet_backup = { services.skynet.backup = {
host = { host = {
ip = ip_pub; ip = ip_pub;
name = name; name = name;

View file

@ -46,7 +46,7 @@ in {
} }
]; ];
services.skynet_backup = { services.skynet.backup = {
host = { host = {
ip = ip_pub; ip = ip_pub;
name = name; name = name;

View file

@ -46,7 +46,7 @@ in {
} }
]; ];
services.skynet_backup = { services.skynet.backup = {
host = { host = {
ip = ip_pub; ip = ip_pub;
name = name; name = name;

View file

@ -47,7 +47,7 @@ in {
} }
]; ];
services.skynet_backup = { services.skynet.backup = {
host = { host = {
ip = ip_pub; ip = ip_pub;
name = name; name = name;

View file

@ -46,7 +46,7 @@ in {
} }
]; ];
services.skynet_backup = { services.skynet.backup = {
host = { host = {
ip = ip_pub; ip = ip_pub;
name = name; name = name;

View file

@ -53,7 +53,7 @@ in {
} }
]; ];
services.skynet_backup = { services.skynet.backup = {
host = { host = {
ip = ip_pub; ip = ip_pub;
name = name; name = name;

View file

@ -63,7 +63,7 @@ in {
} }
]; ];
services.skynet_backup = { services.skynet.backup = {
host = { host = {
ip = ip_pub; ip = ip_pub;
name = name; name = name;

View file

@ -58,7 +58,7 @@ in {
} }
]; ];
services.skynet_backup = { services.skynet.backup = {
server.enable = true; server.enable = true;
host = { host = {
ip = ip_pub; ip = ip_pub;

View file

@ -46,7 +46,7 @@ in {
} }
]; ];
services.skynet_backup = { services.skynet.backup = {
host = { host = {
ip = ip_pub; ip = ip_pub;
name = name; name = name;

View file

@ -49,7 +49,7 @@ in {
} }
]; ];
services.skynet_backup.host = { services.skynet.backup.host = {
ip = ip_pub; ip = ip_pub;
name = name; name = name;
}; };

View file

@ -45,7 +45,7 @@ in {
]; ];
}; };
services.skynet_backup = { services.skynet.backup = {
host = { host = {
ip = ip_pub; ip = ip_pub;
name = name; name = name;

View file

@ -29,7 +29,7 @@ in {
tags = ["active-dns" "dns"]; tags = ["active-dns" "dns"];
}; };
services.skynet_backup = { services.skynet.backup = {
host = { host = {
ip = ip_pub; ip = ip_pub;
name = name; name = name;

View file

@ -45,7 +45,7 @@ in {
} }
]; ];
services.skynet_backup = { services.skynet.backup = {
host = { host = {
ip = ip_pub; ip = ip_pub;
name = name; name = name;