git.iko.soy/typeable/nixpkgs
on master help sign in
nixos/restic: rename s3CredentialsFile to environmentFile

This is done as the s3CredentialsFile specifies the environmentFile for the systemd service, which can be used for more than just s3. Co-authored-by: Cole Helbling <cole.e.helbling@outlook.com>

commit75d64a336b34567021c88e641ff791649cc07681 authoreyjhb <eyjhbb@gmail.com> dateSat 28 Aug 2021, 15:17 (5 years ago) parentcdb3a56
1 file changed+15−3
nixos/modules/services/backup/restic.nix+15−3
nixos/modules/services/backup/restic.nix+15−3
@@ -11,7 +11,7 @@ in
1111 description = ''
1212 Periodic backups to create with Restic.
1313 '';
14− type = types.attrsOf (types.submodule ({ name, ... }: {
14+ type = types.attrsOf (types.submodule ({ config, name, ... }: {
1515 options = {
1616 passwordFile = mkOption {
1717 type = types.str;
@@ -21,6 +21,17 @@ in
2121 example = "/etc/nixos/restic-password";
2222 };
2323
24+ environmentFile = mkOption {
25+ type = with types; nullOr str;
26+ # added on 2021-08-28, s3CredentialsFile should
27+ # be removed in the future (+ remember the warning)
28+ default = config.s3CredentialsFile;
29+ description = ''
30+ file containing the credentials to access the repository, in the
31+ format of an EnvironmentFile as described by systemd.exec(5)
32+ '';
33+ };
34+
2435 s3CredentialsFile = mkOption {
2536 type = with types; nullOr str;
2637 default = null;
@@ -212,6 +223,7 @@ in
212223 };
213224
214225 config = {
226+ warnings = mapAttrsToList (n: v: "services.restic.backups.${n}.s3CredentialsFile is deprecated, please use services.restic.backups.${n}.environmentFile instead.") (filterAttrs (n: v: v.s3CredentialsFile != null) config.services.restic.backups);
215227 systemd.services =
216228 mapAttrs' (name: backup:
217229 let
@@ -251,8 +263,8 @@ in
251263 RuntimeDirectory = "restic-backups-${name}";
252264 CacheDirectory = "restic-backups-${name}";
253265 CacheDirectoryMode = "0700";
254− } // optionalAttrs (backup.s3CredentialsFile != null) {
255− EnvironmentFile = backup.s3CredentialsFile;
266+ } // optionalAttrs (backup.environmentFile != null) {
267+ EnvironmentFile = backup.environmentFile;
256268 };
257269 } // optionalAttrs (backup.initialize || backup.dynamicFilesFrom != null) {
258270 preStart = ''