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>
This commit is contained in:
parent
cdb3a5613e
commit
75d64a336b
1 changed files with 15 additions and 3 deletions
|
@ -11,7 +11,7 @@ in
|
||||||
description = ''
|
description = ''
|
||||||
Periodic backups to create with Restic.
|
Periodic backups to create with Restic.
|
||||||
'';
|
'';
|
||||||
type = types.attrsOf (types.submodule ({ name, ... }: {
|
type = types.attrsOf (types.submodule ({ config, name, ... }: {
|
||||||
options = {
|
options = {
|
||||||
passwordFile = mkOption {
|
passwordFile = mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
|
@ -21,6 +21,17 @@ in
|
||||||
example = "/etc/nixos/restic-password";
|
example = "/etc/nixos/restic-password";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
environmentFile = mkOption {
|
||||||
|
type = with types; nullOr str;
|
||||||
|
# added on 2021-08-28, s3CredentialsFile should
|
||||||
|
# be removed in the future (+ remember the warning)
|
||||||
|
default = config.s3CredentialsFile;
|
||||||
|
description = ''
|
||||||
|
file containing the credentials to access the repository, in the
|
||||||
|
format of an EnvironmentFile as described by systemd.exec(5)
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
s3CredentialsFile = mkOption {
|
s3CredentialsFile = mkOption {
|
||||||
type = with types; nullOr str;
|
type = with types; nullOr str;
|
||||||
default = null;
|
default = null;
|
||||||
|
@ -212,6 +223,7 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
|
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);
|
||||||
systemd.services =
|
systemd.services =
|
||||||
mapAttrs' (name: backup:
|
mapAttrs' (name: backup:
|
||||||
let
|
let
|
||||||
|
@ -251,8 +263,8 @@ in
|
||||||
RuntimeDirectory = "restic-backups-${name}";
|
RuntimeDirectory = "restic-backups-${name}";
|
||||||
CacheDirectory = "restic-backups-${name}";
|
CacheDirectory = "restic-backups-${name}";
|
||||||
CacheDirectoryMode = "0700";
|
CacheDirectoryMode = "0700";
|
||||||
} // optionalAttrs (backup.s3CredentialsFile != null) {
|
} // optionalAttrs (backup.environmentFile != null) {
|
||||||
EnvironmentFile = backup.s3CredentialsFile;
|
EnvironmentFile = backup.environmentFile;
|
||||||
};
|
};
|
||||||
} // optionalAttrs (backup.initialize || backup.dynamicFilesFrom != null) {
|
} // optionalAttrs (backup.initialize || backup.dynamicFilesFrom != null) {
|
||||||
preStart = ''
|
preStart = ''
|
||||||
|
|
Loading…
Reference in a new issue