1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-30 06:59:45 +01:00
home-manager/tests/modules/files/out-of-store-symlink.nix
2023-05-13 00:09:52 +02:00

25 lines
615 B
Nix

{ config, ... }:
let
filePath = ./. + "/source with spaces!";
in {
home.file."oos".source = config.lib.file.mkOutOfStoreSymlink filePath;
nmt.script = ''
assertLinkExists "home-files/oos"
storePath="$(readlink $TESTED/home-files/oos)"
if [[ ! -L $storePath ]]; then
fail "Expected $storePath to be a symbolic link, but it was not."
fi
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
'';
}