aboutsummaryrefslogtreecommitdiff
path: root/modules/private/system/backup-2.nix
diff options
context:
space:
mode:
Diffstat (limited to 'modules/private/system/backup-2.nix')
-rw-r--r--modules/private/system/backup-2.nix37
1 files changed, 19 insertions, 18 deletions
diff --git a/modules/private/system/backup-2.nix b/modules/private/system/backup-2.nix
index 5d692c6..84e52d5 100644
--- a/modules/private/system/backup-2.nix
+++ b/modules/private/system/backup-2.nix
@@ -1,15 +1,16 @@
1{ privateFiles }: 1{ privateFiles }:
2{ config, pkgs, myconfig, resources, ... }: 2{ config, pkgs, resources, ... }:
3{ 3{
4 boot.kernelPackages = pkgs.linuxPackages_latest; 4 boot.kernelPackages = pkgs.linuxPackages_latest;
5 _module.args.privateFiles = privateFiles; 5 myEnv = import "${privateFiles}/environment.nix" // { inherit privateFiles; };
6 _module.args.hostFQDN = "backup-2.v.immae.eu"; 6 hostEnv.FQDN = "backup-2.v.immae.eu";
7
7 imports = builtins.attrValues (import ../..); 8 imports = builtins.attrValues (import ../..);
8 9
9 deployment = { 10 deployment = {
10 targetEnv = "hetznerCloud"; 11 targetEnv = "hetznerCloud";
11 hetznerCloud = { 12 hetznerCloud = {
12 authToken = myconfig.env.hetznerCloud.authToken; 13 authToken = config.myEnv.hetznerCloud.authToken;
13 datacenter = "hel1-dc2"; 14 datacenter = "hel1-dc2";
14 location ="hel1"; 15 location ="hel1";
15 serverType = "cx11"; 16 serverType = "cx11";
@@ -27,10 +28,10 @@
27 firewall.enable = true; 28 firewall.enable = true;
28 interfaces."ens3".ipv4.addresses = pkgs.lib.attrsets.mapAttrsToList 29 interfaces."ens3".ipv4.addresses = pkgs.lib.attrsets.mapAttrsToList
29 (n: ips: { address = ips.ip4; prefixLength = 32; }) 30 (n: ips: { address = ips.ip4; prefixLength = 32; })
30 (pkgs.lib.attrsets.filterAttrs (n: v: n != "main") myconfig.env.servers.backup-2.ips); 31 (pkgs.lib.attrsets.filterAttrs (n: v: n != "main") config.myEnv.servers.backup-2.ips);
31 interfaces."ens3".ipv6.addresses = pkgs.lib.flatten (pkgs.lib.attrsets.mapAttrsToList 32 interfaces."ens3".ipv6.addresses = pkgs.lib.flatten (pkgs.lib.attrsets.mapAttrsToList
32 (n: ips: map (ip: { address = ip; prefixLength = (if n == "main" && ip == pkgs.lib.head ips.ip6 then 64 else 128); }) (ips.ip6 or [])) 33 (n: ips: map (ip: { address = ip; prefixLength = (if n == "main" && ip == pkgs.lib.head ips.ip6 then 64 else 128); }) (ips.ip6 or []))
33 myconfig.env.servers.backup-2.ips); 34 config.myEnv.servers.backup-2.ips);
34 35
35 defaultMailServer = { 36 defaultMailServer = {
36 directDelivery = true; 37 directDelivery = true;
@@ -48,10 +49,10 @@
48 49
49 services.rsyncBackup = { 50 services.rsyncBackup = {
50 mountpoint = "/backup2"; 51 mountpoint = "/backup2";
51 mailto = myconfig.env.rsync_backup.mailto; 52 mailto = config.myEnv.rsync_backup.mailto;
52 profiles = myconfig.env.rsync_backup.profiles; 53 profiles = config.myEnv.rsync_backup.profiles;
53 ssh_key_public = myconfig.env.rsync_backup.ssh_key.public; 54 ssh_key_public = config.myEnv.rsync_backup.ssh_key.public;
54 ssh_key_private = myconfig.env.rsync_backup.ssh_key.private; 55 ssh_key_private = config.myEnv.rsync_backup.ssh_key.private;
55 }; 56 };
56 57
57 myServices.monitoring.enable = true; 58 myServices.monitoring.enable = true;
@@ -62,7 +63,7 @@
62 hosts = { 63 hosts = {
63 eldiron = { 64 eldiron = {
64 slot = "backup_2"; 65 slot = "backup_2";
65 connection = "postgresql://backup-2:${myconfig.env.ldap.backup-2.password}@eldiron.immae.eu"; 66 connection = "postgresql://backup-2:${config.myEnv.servers.backup-2.ldap.password}@eldiron.immae.eu";
66 }; 67 };
67 }; 68 };
68 }; 69 };
@@ -73,12 +74,12 @@
73 eldiron = { 74 eldiron = {
74 serverId = 2; 75 serverId = 2;
75 # mysql resolves "backup-2" host and checks the ip, but uses /etc/hosts which only contains ip4 76 # mysql resolves "backup-2" host and checks the ip, but uses /etc/hosts which only contains ip4
76 host = myconfig.env.servers.eldiron.ips.main.ip4; 77 host = config.myEnv.servers.eldiron.ips.main.ip4;
77 port = "3306"; 78 port = "3306";
78 user = "backup-2"; 79 user = "backup-2";
79 password = myconfig.env.ldap.backup-2.password; 80 password = config.myEnv.servers.backup-2.ldap.password;
80 dumpUser = "root"; 81 dumpUser = "root";
81 dumpPassword = myconfig.env.databases.mysql.systemUsers.root; 82 dumpPassword = config.myEnv.databases.mysql.systemUsers.root;
82 }; 83 };
83 }; 84 };
84 }; 85 };
@@ -97,10 +98,10 @@
97 base = "/backup2"; 98 base = "/backup2";
98 hosts = { 99 hosts = {
99 eldiron = { 100 eldiron = {
100 url = "ldaps://${myconfig.env.ldap.host}:636"; 101 url = "ldaps://${config.myEnv.ldap.host}:636";
101 dn = myconfig.env.ldap.replication_dn; 102 dn = config.myEnv.ldap.replication_dn;
102 password = myconfig.env.ldap.replication_pw; 103 password = config.myEnv.ldap.replication_pw;
103 base = myconfig.env.ldap.base; 104 base = config.myEnv.ldap.base;
104 }; 105 };
105 }; 106 };
106 }; 107 };