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:
parent
f15be4feb6
commit
2eabb26d08
3 changed files with 24 additions and 2 deletions
|
|
@ -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"
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
''}";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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()
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue