diff options
| author | Domen Kožar <domen@dev.si> | 2022-11-01 09:17:24 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-11-01 09:17:24 +0000 |
| commit | 21791d4c017014a990d6285b68233fb77b8a1391 (patch) | |
| tree | 2587cb9c4b96fdce19df5d26ec2a38fdea652d80 /modules/system | |
| parent | f6648ca0698d1611d7eadfa72b122252b833f86c (diff) | |
| parent | ed1e73d01e439c80cb2088e0190410236beb5826 (diff) | |
Merge pull request #470 from toonn/berbiche-fix-applications-symlink
Disable taking control of ~/Applications folder MkII
Diffstat (limited to 'modules/system')
| -rw-r--r-- | modules/system/applications.nix | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/modules/system/applications.nix b/modules/system/applications.nix index 8183e0a..9dd8766 100644 --- a/modules/system/applications.nix +++ b/modules/system/applications.nix @@ -22,14 +22,26 @@ in system.activationScripts.applications.text = '' # Set up applications. - echo "setting up ~/Applications..." >&2 + echo "setting up /Applications/Nix Apps..." >&2 + + 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 -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 + 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 ''; |
