1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-12-03 15:41:02 +01:00

restic: allow the convenience script to source environmentFile (#6947)

This commit is contained in:
Jess 2025-05-03 01:23:57 +12:00 committed by GitHub
parent f15be4feb6
commit 2eabb26d08
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 24 additions and 2 deletions

View file

@ -508,8 +508,12 @@ in
in in
pkgs.writeShellApplication { pkgs.writeShellApplication {
name = "restic-${name}"; name = "restic-${name}";
# https://github.com/koalaman/shellcheck/issues/1986 excludeShellChecks = [
excludeShellChecks = [ "SC2034" ]; # https://github.com/koalaman/shellcheck/issues/1986
"SC2034"
# Allow sourcing environmentFile
"SC1091"
];
bashOptions = [ bashOptions = [
"errexit" "errexit"
"nounset" "nounset"

View file

@ -119,6 +119,16 @@ in
"--keep-hourly 3" "--keep-hourly 3"
]; ];
}; };
env-file = {
inherit passwordFile paths exclude;
initialize = true;
repository = "/home/alice/repos/env-file";
environmentFile = "${pkgs.writeText "environmentFile" ''
SECRET=1234
TOKEN=123456789ABcdEF
''}";
};
}; };
}; };
} }

View file

@ -271,6 +271,14 @@ in
with subtest("Prune opts"): with subtest("Prune opts"):
systemctl_succeed_as_alice("start restic-backups-prune-opts.service") systemctl_succeed_as_alice("start restic-backups-prune-opts.service")
with subtest("Environment file"):
systemctl_succeed_as_alice("start restic-backups-env-file.service")
actual = succeed_as_alice("restic-env-file ls latest")
assert_list("restic-env-file ls latest", expectedIncluded, actual)
assert "exclude" not in actual, \
f"Paths containing \"*exclude*\" got backed up incorrectly. output: {actual}"
logout_alice() logout_alice()
''; '';
} }