summary refs log tree commit diff
path: root/nixos/modules/services/backup/restic.nix
diff options
context:
space:
mode:
authorMatt McHenry <github@matt.mchenryfamily.org>2018-05-30 22:30:12 -0400
committerMatt McHenry <github@matt.mchenryfamily.org>2018-06-02 14:12:23 -0400
commitc61aad65744cbeca78504b64f4b346870e3bf2f7 (patch)
tree6cb0220e3ef16feacb20a29cddde07de376fdbe1 /nixos/modules/services/backup/restic.nix
parent5da85431fb1df4fb3ac36730b2591ccc9bdf5c21 (diff)
downloadnixlib-c61aad65744cbeca78504b64f4b346870e3bf2f7.tar
nixlib-c61aad65744cbeca78504b64f4b346870e3bf2f7.tar.gz
nixlib-c61aad65744cbeca78504b64f4b346870e3bf2f7.tar.bz2
nixlib-c61aad65744cbeca78504b64f4b346870e3bf2f7.tar.lz
nixlib-c61aad65744cbeca78504b64f4b346870e3bf2f7.tar.xz
nixlib-c61aad65744cbeca78504b64f4b346870e3bf2f7.tar.zst
nixlib-c61aad65744cbeca78504b64f4b346870e3bf2f7.zip
restic: add s3CredentialsFile option
Diffstat (limited to 'nixos/modules/services/backup/restic.nix')
-rw-r--r--nixos/modules/services/backup/restic.nix10
1 files changed, 10 insertions, 0 deletions
diff --git a/nixos/modules/services/backup/restic.nix b/nixos/modules/services/backup/restic.nix
index 21d82469c605..2d14762e8685 100644
--- a/nixos/modules/services/backup/restic.nix
+++ b/nixos/modules/services/backup/restic.nix
@@ -14,7 +14,15 @@ with lib;
             Read the repository password from a file.
           '';
           example = "/etc/nixos/restic-password";
+        };
 
+        s3CredentialsFile = mkOption {
+          type = with types; nullOr str;
+          description = ''
+            file containing the AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY
+            for an S3-hosted repository, in the format of an EnvironmentFile
+            as described by systemd.exec(5)
+          '';
         };
 
         repository = mkOption {
@@ -134,6 +142,8 @@ with lib;
             Type = "oneshot";
             ExecStart = "${resticCmd} backup ${concatStringsSep " " backup.extraBackupArgs} ${concatStringsSep " " backup.paths}";
             User = backup.user;
+          } // optionalAttrs (backup.s3CredentialsFile != null) {
+            EnvironmentFile = backup.s3CredentialsFile;
           };
         } // optionalAttrs backup.initialize {
           preStart = ''