Skip to content

Commit

Permalink
home-manager/zsh: make realise-symlink support directories
Browse files Browse the repository at this point in the history
  • Loading branch information
thiagokokada committed Jul 31, 2024
1 parent 868ac3d commit 6fff3b9
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions home-manager/cli/zsh/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,17 @@ let
text = ''
for file in "$@"; do
if [[ -L "$file" ]]; then
cp --verbose --remove-destination "$(readlink "$file")" "$file"
chmod --changes +w "$file"
if [[ -d "$file" ]]; then
tmpdir="''${file}.tmp"
mkdir -p "$tmpdir"
cp --verbose --recursive "$file"/* "$tmpdir"
unlink "$file"
mv "$tmpdir" "$file"
chmod --changes --recursive +w "$file"
else
cp --verbose --remove-destination "$(readlink "$file")" "$file"
chmod --changes +w "$file"
fi
else
>&2 echo "Not a symlink: $file"
exit 1
Expand Down

0 comments on commit 6fff3b9

Please sign in to comment.