aboutsummaryrefslogtreecommitdiff
path: root/home-manager/tests/modules/files/out-of-store-symlink.nix
diff options
context:
space:
mode:
Diffstat (limited to 'home-manager/tests/modules/files/out-of-store-symlink.nix')
-rw-r--r--home-manager/tests/modules/files/out-of-store-symlink.nix29
1 files changed, 29 insertions, 0 deletions
diff --git a/home-manager/tests/modules/files/out-of-store-symlink.nix b/home-manager/tests/modules/files/out-of-store-symlink.nix
new file mode 100644
index 00000000000..af274aaebec
--- /dev/null
+++ b/home-manager/tests/modules/files/out-of-store-symlink.nix
@@ -0,0 +1,29 @@
+{ config, lib, ... }:
+
+with lib;
+
+let
+
+ filePath = ./. + "/source with spaces!";
+
+in {
+ config = {
+ 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
+ '';
+ };
+}