2023-09-12 08:44:05 -06:00
|
|
|
{ lib
|
|
|
|
, pkgs
|
|
|
|
, config
|
|
|
|
, ...
|
2023-07-11 09:12:50 -06:00
|
|
|
}:
|
2023-04-17 10:43:10 -06:00
|
|
|
assert (builtins.length
|
2023-07-11 09:12:50 -06:00
|
|
|
(lib.mapAttrsToList (a: _: a) config.services.restic.backups))
|
2023-09-12 08:44:05 -06:00
|
|
|
<= 1; let
|
2023-04-17 10:43:10 -06:00
|
|
|
resticBin = "${pkgs.restic}/bin/restic";
|
|
|
|
cfg = config.services.restic.backups;
|
|
|
|
bkp = lib.mapAttrs' (_: lib.nameValuePair "default") cfg;
|
2023-09-12 08:44:05 -06:00
|
|
|
in
|
|
|
|
''
|
2022-08-26 20:24:39 -06:00
|
|
|
#!/usr/bin/env sh
|
|
|
|
|
2023-04-17 10:43:10 -06:00
|
|
|
set -e
|
|
|
|
|
|
|
|
export $(cat ${bkp.default.environmentFile})
|
|
|
|
${resticBin} -r ${bkp.default.repository} --password-file ${bkp.default.passwordFile} $@
|
2022-08-26 20:24:39 -06:00
|
|
|
''
|