2023-04-17 10:43:10 -06:00
|
|
|
{ lib, pkgs, config, ... }:
|
2022-08-26 20:24:39 -06:00
|
|
|
|
2023-04-17 10:43:10 -06:00
|
|
|
assert (builtins.length
|
|
|
|
(lib.mapAttrsToList (a: _: a) config.services.restic.backups)) <= 1;
|
|
|
|
|
|
|
|
let
|
|
|
|
resticBin = "${pkgs.restic}/bin/restic";
|
|
|
|
cfg = config.services.restic.backups;
|
|
|
|
bkp = lib.mapAttrs' (_: lib.nameValuePair "default") cfg;
|
2022-08-26 20:24:39 -06:00
|
|
|
in ''
|
|
|
|
#!/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
|
|
|
''
|