summaryrefslogtreecommitdiff
path: root/pkgs
diff options
context:
space:
mode:
authorMichael Hoang <enzime@users.noreply.github.com>2024-11-05 01:14:16 +1100
committerMichael Hoang <enzime@users.noreply.github.com>2024-11-07 18:17:34 +1100
commit1b5fa6be405425ae5040d68c4a3bfff14fdf2100 (patch)
tree10702ab7782deeef8ca40497758144ddde86288d /pkgs
parent84ad3a2d7ea74cabd7f71261ca4a191585d47beb (diff)
uninstaller: remove unnecessary attempt to delete `nix-daemon`
Fixes https://github.com/LnL7/nix-darwin/issues/910
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/darwin-uninstaller/configuration.nix14
1 files changed, 6 insertions, 8 deletions
diff --git a/pkgs/darwin-uninstaller/configuration.nix b/pkgs/darwin-uninstaller/configuration.nix
index 6487774..0bdccb9 100644
--- a/pkgs/darwin-uninstaller/configuration.nix
+++ b/pkgs/darwin-uninstaller/configuration.nix
@@ -7,31 +7,29 @@ with lib;
assertions = mkForce [];
system.activationScripts.checks.text = mkForce "";
- # Disable etc, launchd, ...
environment.etc = mkForce {};
launchd.agents = mkForce {};
launchd.daemons = mkForce {};
launchd.user.agents = mkForce {};
system.activationScripts.postUserActivation.text = mkAfter ''
- if test -L ~/.nix-defexpr/channels/darwin; then
+ if [[ -L ~/.nix-defexpr/channels/darwin ]]; then
nix-channel --remove darwin || true
fi
'';
system.activationScripts.postActivation.text = mkAfter ''
- if test -L /Applications/Nix\ Apps; then
+ if [[ -L /Applications/Nix\ Apps ]]; then
rm /Applications/Nix\ Apps
fi
- if test -L /etc/static; then
+ if [[ -L /etc/static ]]; then
rm /etc/static
fi
- if test -O /nix/store; then
- if ! test -e /Library/LaunchDaemons/org.nixos.nix-daemon.plist; then
- sudo rm /Library/LaunchDaemons/org.nixos.nix-daemon.plist || true
- sudo launchctl remove org.nixos.nix-daemon 2> /dev/null || true
+ # If the Nix Store is owned by root then we're on a multi-user system
+ if [[ -O /nix/store ]]; then
+ if [[ -e /nix/var/nix/profiles/default/Library/LaunchDaemons/org.nixos.nix-daemon.plist ]]; then
sudo cp /nix/var/nix/profiles/default/Library/LaunchDaemons/org.nixos.nix-daemon.plist /Library/LaunchDaemons/org.nixos.nix-daemon.plist
sudo launchctl load -w /Library/LaunchDaemons/org.nixos.nix-daemon.plist
fi