From ec348e03e00353b6cbd4ff53e66e887b75c007e1 Mon Sep 17 00:00:00 2001 From: Robin Stumm Date: Thu, 6 Jul 2017 18:31:40 +0200 Subject: [PATCH] fix `home.activation.checkLinkTargets` ====================================== MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Problem ------- We resolve symlinks from inside `/nix/store/HASH-home-manager-files` into the nix store as `/nix/store/HASH-DRVNAME` which does not match the pattern. This happened to me because I pull in some repos in via `home.file`. The `home-manager-files` derivation links to the repo's derivation in the nix store. For example: let nanorcs = fetchFromGitHub { owner = "scopatz"; repo = "nanorc"; … }; in [ { target = ".nano"; source = nanorcs; } { target = ".nanorc"; source = "${nanorcs}/nanorc"; } ] Solution -------- Call `readlink` without `-e` to obtain only the first redirection from `~` to `/nix/store/HASH-home-manager-files`. --- modules/home-environment.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/home-environment.nix b/modules/home-environment.nix index 79b4f344..cf4c49c5 100644 --- a/modules/home-environment.nix +++ b/modules/home-environment.nix @@ -260,7 +260,7 @@ in relativePath="''${sourcePath#$newGenFiles/}" targetPath="$HOME/$relativePath" if [[ -e "$targetPath" \ - && ! "$(readlink -e "$targetPath")" =~ "${pattern}" ]] ; then + && ! "$(readlink "$targetPath")" =~ "${pattern}" ]] ; then errorEcho "Existing file '$targetPath' is in the way" collision=1 fi