mirror of
https://github.com/nix-community/home-manager
synced 2024-11-24 03:59:46 +01:00
home-environment: 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`.
(cherry picked from commit 89dc8c2004
)
This commit is contained in:
parent
3c3f68bf61
commit
540e90d3fa
1 changed files with 1 additions and 1 deletions
|
@ -260,7 +260,7 @@ in
|
||||||
relativePath="''${sourcePath#$newGenFiles/}"
|
relativePath="''${sourcePath#$newGenFiles/}"
|
||||||
targetPath="$HOME/$relativePath"
|
targetPath="$HOME/$relativePath"
|
||||||
if [[ -e "$targetPath" \
|
if [[ -e "$targetPath" \
|
||||||
&& ! "$(readlink -e "$targetPath")" =~ "${pattern}" ]] ; then
|
&& ! "$(readlink "$targetPath")" =~ "${pattern}" ]] ; then
|
||||||
errorEcho "Existing file '$targetPath' is in the way"
|
errorEcho "Existing file '$targetPath' is in the way"
|
||||||
collision=1
|
collision=1
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue