mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-27 01:13:05 +00:00
nixos/restic: reformat
Apply nixpkgs-fmt on file prior doing changes. Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
This commit is contained in:
parent
3ead2b58f5
commit
082a4184ec
@ -225,12 +225,14 @@ in
|
||||
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 =
|
||||
mapAttrs' (name: backup:
|
||||
mapAttrs'
|
||||
(name: backup:
|
||||
let
|
||||
extraOptions = concatMapStrings (arg: " -o ${arg}") backup.extraOptions;
|
||||
resticCmd = "${pkgs.restic}/bin/restic${extraOptions}";
|
||||
filesFromTmpFile = "/run/restic-backups-${name}/includes";
|
||||
backupPaths = if (backup.dynamicFilesFrom == null)
|
||||
backupPaths =
|
||||
if (backup.dynamicFilesFrom == null)
|
||||
then if (backup.paths != null) then concatStringsSep " " backup.paths else ""
|
||||
else "--files-from ${filesFromTmpFile}";
|
||||
pruneCmd = optionals (builtins.length backup.pruneOpts > 0) [
|
||||
@ -242,17 +244,22 @@ in
|
||||
rcloneAttrToOpt = v: "RCLONE_" + toUpper (builtins.replaceStrings [ "-" ] [ "_" ] v);
|
||||
rcloneAttrToConf = v: "RCLONE_CONFIG_" + toUpper (rcloneRemoteName + "_" + v);
|
||||
toRcloneVal = v: if lib.isBool v then lib.boolToString v else v;
|
||||
in nameValuePair "restic-backups-${name}" ({
|
||||
in
|
||||
nameValuePair "restic-backups-${name}" ({
|
||||
environment = {
|
||||
RESTIC_PASSWORD_FILE = backup.passwordFile;
|
||||
RESTIC_REPOSITORY = backup.repository;
|
||||
} // optionalAttrs (backup.rcloneOptions != null) (mapAttrs' (name: value:
|
||||
} // optionalAttrs (backup.rcloneOptions != null) (mapAttrs'
|
||||
(name: value:
|
||||
nameValuePair (rcloneAttrToOpt name) (toRcloneVal value)
|
||||
) backup.rcloneOptions) // optionalAttrs (backup.rcloneConfigFile != null) {
|
||||
)
|
||||
backup.rcloneOptions) // optionalAttrs (backup.rcloneConfigFile != null) {
|
||||
RCLONE_CONFIG = backup.rcloneConfigFile;
|
||||
} // optionalAttrs (backup.rcloneConfig != null) (mapAttrs' (name: value:
|
||||
} // optionalAttrs (backup.rcloneConfig != null) (mapAttrs'
|
||||
(name: value:
|
||||
nameValuePair (rcloneAttrToConf name) (toRcloneVal value)
|
||||
) backup.rcloneConfig);
|
||||
)
|
||||
backup.rcloneConfig);
|
||||
path = [ pkgs.openssh ];
|
||||
restartIfChanged = false;
|
||||
serviceConfig = {
|
||||
@ -280,11 +287,14 @@ in
|
||||
rm ${filesFromTmpFile}
|
||||
'';
|
||||
})
|
||||
) config.services.restic.backups;
|
||||
)
|
||||
config.services.restic.backups;
|
||||
systemd.timers =
|
||||
mapAttrs' (name: backup: nameValuePair "restic-backups-${name}" {
|
||||
mapAttrs'
|
||||
(name: backup: nameValuePair "restic-backups-${name}" {
|
||||
wantedBy = [ "timers.target" ];
|
||||
timerConfig = backup.timerConfig;
|
||||
}) config.services.restic.backups;
|
||||
})
|
||||
config.services.restic.backups;
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user