From 1a2861baa64c7aec4f3c3671ad66339802456514 Mon Sep 17 00:00:00 2001 From: John Soo Date: Fri, 3 Dec 2021 16:03:49 -0800 Subject: [PATCH] launchd: Swap OtherJobEnabled->PathState for nix-daemon. This seems to be all that is necessary to run the daemon when /nix is mounted. * Keep RunAtLoad=false so that the daemon executable is not found when launchd loads the service. * Keep RunAtLoad=true in darwin-store so that it always runs. --- misc/launchd/org.nixos.nix-daemon.plist.in | 8 +++++--- scripts/create-darwin-volume.sh | 16 +++++++--------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/misc/launchd/org.nixos.nix-daemon.plist.in b/misc/launchd/org.nixos.nix-daemon.plist.in index bc02dc72c..bce3d10f3 100644 --- a/misc/launchd/org.nixos.nix-daemon.plist.in +++ b/misc/launchd/org.nixos.nix-daemon.plist.in @@ -13,12 +13,14 @@ org.nixos.nix-daemon KeepAlive - OtherJobEnabled + PathState - org.nixos.darwin-store - + /nix/var/nix/profiles/default/bin/nix-daemon + + RunAtLoad + ProgramArguments /nix/var/nix/profiles/default/bin/nix-daemon diff --git a/scripts/create-darwin-volume.sh b/scripts/create-darwin-volume.sh index b0563a4d1..334b75045 100755 --- a/scripts/create-darwin-volume.sh +++ b/scripts/create-darwin-volume.sh @@ -303,16 +303,8 @@ generate_mount_daemon() { - LaunchOnlyOnce + RunAtLoad - KeepAlive - - PathState - - $NIX_ROOT/store - - - Label org.nixos.darwin-store ProgramArguments @@ -812,6 +804,12 @@ EOF # TODO: should probably alert the user if this is disabled? _sudo "to launch the Nix volume mounter" \ launchctl bootstrap system "$NIX_VOLUME_MOUNTD_DEST" || true + # TODO: confirm whether kickstart is necessesary? + # I feel a little superstitous, but it can guard + # against multiple problems (doesn't start, old + # version still running for some reason...) + _sudo "to launch the Nix volume mounter" \ + launchctl kickstart -k system/org.nixos.darwin-store fi }