1
0
Fork 0
mirror of https://github.com/LnL7/nix-darwin.git synced 2025-03-05 08:17:01 +00:00

Merge pull request #470 from toonn/berbiche-fix-applications-symlink

Disable taking control of ~/Applications folder MkII
This commit is contained in:
Domen Kožar 2022-11-01 09:17:24 +00:00 committed by GitHub
commit 21791d4c01
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -22,14 +22,26 @@ in
system.activationScripts.applications.text = ''
# Set up applications.
echo "setting up ~/Applications..." >&2
echo "setting up /Applications/Nix Apps..." >&2
if [ ! -e ~/Applications -o -L ~/Applications ]; then
ln -sfn ${cfg.build.applications}/Applications ~/Applications
elif [ ! -e ~/Applications/Nix\ Apps -o -L ~/Applications/Nix\ Apps ]; then
ln -sfn ${cfg.build.applications}/Applications ~/Applications/Nix\ Apps
ourLink () {
local link
link=$(readlink "$1")
[ -L "$1" ] && [ "''${link#*-}" = 'system-applications/Applications' ]
}
# Clean up for links created at the old location in HOME
if ourLink ~/Applications; then
rm ~/Applications
elif ourLink ~/Applications/'Nix Apps'; then
rm ~/Applications/'Nix Apps'
fi
if [ ! -e '/Applications/Nix Apps' ] \
|| ourLink '/Applications/Nix Apps'; then
ln -sfn ${cfg.build.applications}/Applications '/Applications/Nix Apps'
else
echo "warning: ~/Applications and ~/Applications/Nix Apps are directories, skipping App linking..." >&2
echo "warning: /Applications/Nix Apps is not owned by nix-darwin, skipping App linking..." >&2
fi
'';