1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-12-02 16:09:46 +01:00

Files: allow target to be the home directory, for recursively-linked directories

In order to create assorted symlinks directly in the home directory, it might be necessary to have a `home.file` directive which targets the home directory directly.
This is only allowed for recursively-linked directories, as even a simply-linked directory would cause the system to break (due to a readonly ~/.nix-profile, among others)
This commit is contained in:
niacdoial 2022-09-18 15:47:30 +02:00
parent 60c6bfe322
commit 27981ab4a2
No known key found for this signature in database
GPG key ID: D2B9B9FE6D7B1C8E

View file

@ -343,8 +343,13 @@ in
# We therefore simply log the conflict and otherwise ignore it, mainly # We therefore simply log the conflict and otherwise ignore it, mainly
# to make the `files-target-config` test work as expected. # to make the `files-target-config` test work as expected.
if [[ -e "$realOut/$relTarget" ]]; then if [[ -e "$realOut/$relTarget" ]]; then
echo "File conflict for file '$relTarget'" >&2 if [[ -d "$realOut/$relTarget" && $(realpath "$realOut/$relTarget") == $realOut && $recursive ]]; then
return # exception: allow a "collision" for a recureively linked home *directory*
:
else
echo "File conflict for file '$relTarget'" >&2
return
fi
fi fi
# Figure out the real absolute path to the target. # Figure out the real absolute path to the target.