]> git.immae.eu Git - perso/Immae/Config/Nix.git/blobdiff - flakes/private/environment/flake.nix
Migrate to borg backup
[perso/Immae/Config/Nix.git] / flakes / private / environment / flake.nix
index 24cbb7a0202e5ec97ad21e912754da52d03e3e67..49b203e944dcf512c8e1caa25fb6a680827420d4 100644 (file)
               };
             };
           };
+          borg_backup = mkOption {
+            description = ''
+              Remote backup with borg/borgmatic
+            '';
+            type = submodule {
+              options = {
+                password = mkOption { type = str; description = "Password for encrypting files"; };
+                remotes = mkOption {
+                  type = attrsOf (submodule {
+                    options = {
+                      remote = mkOption {
+                        type = functionTo str;
+                        example = literalExample ''
+                          bucket: "ssh://some_host/${bucket}";
+                          '';
+                        description = ''
+                          Function.
+                          Takes a bucket name as argument and returns a url
+                          '';
+                      };
+                      sshRsyncPort = mkOption { type = str; default = "22"; description = "SSH port"; };
+                      sshRsyncHost = mkOption { type = nullOr str; default = null; description = "SSH host"; };
+
+                      sshKnownHosts = mkOption { type = nullOr str; default = null; description = "Ssh known hosts"; };
+                    };
+                  });
+                };
+              };
+            };
+          };
           backup = mkOption {
             description = ''
               Remote backup with duplicity
                 remotes = mkOption {
                   type = attrsOf (submodule {
                     options = {
+                      remote_type = mkOption {
+                        type = enum [ "s3" "rsync" ];
+                      };
                       remote = mkOption {
                         type = functionTo str;
                         example = literalExample ''
                           Takes a bucket name as argument and returns a url
                           '';
                       };
-                      accessKeyId = mkOption { type = str; description = "Remote access-key"; };
-                      secretAccessKey = mkOption { type = str; description = "Remote access secret"; };
+                      sshRsyncPort = mkOption { type = str; default = "22"; description = "SSH port for rsync"; };
+                      sshRsyncHost = mkOption { type = nullOr str; default = null; description = "SSH host for rsync"; };
+
+                      sshKnownHosts = mkOption { type = nullOr str; default = null; description = "Ssh known hosts"; };
+                      s3AccessKeyId = mkOption { type = nullOr str; default = null; description = "Remote access-key"; };
+                      s3SecretAccessKey = mkOption { type = nullOr str; default = null; description = "Remote access secret"; };
                     };
                   });
                 };