1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-03-10 02:36:54 +00:00
home-manager/tests/modules/programs/borgmatic/exclude-hm-symlinks-nothing-else.nix
Robert Helgesson 7a3f0b3b8d
tests: rework derivation stubbing
Instead of having to manually stub packages that should not be
downloaded we instead automatically stub all packages (except a small
list of whitelisted ones). Tests can re-introduce the real package by
using the `realPkgs` module argument.
2025-02-04 23:58:20 +01:00

33 lines
778 B
Nix

{ realPkgs, ... }:
{
programs.borgmatic = {
enable = true;
backups = {
main = {
location = {
sourceDirectories = [ "/my-stuff-to-backup" ];
repositories = [ "/mnt/disk1" ];
excludeHomeManagerSymlinks = true;
};
};
};
};
nmt.script = ''
config_file=$TESTED/home-files/.config/borgmatic.d/main.yaml
assertFileExists $config_file
yq=${realPkgs.yq-go}/bin/yq
hmExclusionsFile=$($yq '.exclude_from[0]' $config_file)
expected_content='/home/hm-user/.config/borgmatic.d/main.yaml'
grep --quiet "$expected_content" "$hmExclusionsFile"
if [[ $? -ne 0 ]]; then
echo "Expected to find $expected_content in file $hmExclusionsFile but didn't" >&2
exit 1
fi
'';
}