1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-27 05:29:46 +01:00

fix home.activation.checkLinkTargets

======================================

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`.
This commit is contained in:
Robin Stumm 2017-07-06 18:31:40 +02:00 committed by Robert Helgesson
parent e274fc732b
commit cb569c502e
No known key found for this signature in database
GPG key ID: C3DB11069E65DC86

View file

@ -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