From e07f08c0dcbf2f10a51f76ac2910c25e25ff4d84 Mon Sep 17 00:00:00 2001 From: Michael Hoang Date: Mon, 11 Nov 2024 23:05:03 +1100 Subject: [PATCH] uninstaller: fix restoring nix-daemon launchd daemon --- pkgs/darwin-uninstaller/configuration.nix | 3 +++ pkgs/darwin-uninstaller/default.nix | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/pkgs/darwin-uninstaller/configuration.nix b/pkgs/darwin-uninstaller/configuration.nix index 75d1cacf..295477a6 100644 --- a/pkgs/darwin-uninstaller/configuration.nix +++ b/pkgs/darwin-uninstaller/configuration.nix @@ -12,6 +12,9 @@ with lib; launchd.daemons = mkForce {}; launchd.user.agents = mkForce {}; + # Don't try to reload `nix-daemon` + nix.useDaemon = mkForce false; + system.activationScripts.postUserActivation.text = mkAfter '' if [[ -L ~/.nix-defexpr/channels/darwin ]]; then nix-channel --remove darwin || true diff --git a/pkgs/darwin-uninstaller/default.nix b/pkgs/darwin-uninstaller/default.nix index 17c0a460..f6e04504 100644 --- a/pkgs/darwin-uninstaller/default.nix +++ b/pkgs/darwin-uninstaller/default.nix @@ -31,7 +31,9 @@ in writeShellApplication { echo >&2 " - remove /Applications/Nix Apps symlink" echo >&2 " - cleanup static /etc files" echo >&2 " - disable and remove all launchd services managed by nix-darwin" - echo >&2 " - restore daemon service from nix installer (only when this is a multi-user install)" + if [[ $(stat -f '%Su' /nix/store) == "root" ]]; then + echo >&2 " - restore nix-daemon service from nix installer as this is a multi-user install" + fi echo >&2 if [[ -t 0 ]]; then