1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-23 11:39:46 +01:00
home-manager/tests/modules/files/out-of-store-symlink.nix

26 lines
615 B
Nix
Raw Normal View History

2023-05-13 00:08:12 +02:00
{ config, ... }:
let
filePath = ./. + "/source with spaces!";
in {
2023-05-13 00:08:12 +02:00
home.file."oos".source = config.lib.file.mkOutOfStoreSymlink filePath;
2023-05-13 00:08:12 +02:00
nmt.script = ''
assertLinkExists "home-files/oos"
2023-05-13 00:08:12 +02:00
storePath="$(readlink $TESTED/home-files/oos)"
2023-05-13 00:08:12 +02:00
if [[ ! -L $storePath ]]; then
fail "Expected $storePath to be a symbolic link, but it was not."
fi
2023-05-13 00:08:12 +02:00
actual="$(readlink "$storePath")"
expected="${toString filePath}"
if [[ $actual != $expected ]]; then
fail "Symlink home-files/oos should point to $expected via the Nix store, but it actually points to $actual."
fi
'';
}