| name | nix-service |
| description | Manage nix-managed launchd and systemd services |
| allowed-tools | ["Bash","Read"] |
Nix Service Management
macOS (launchd)
Discovery
launchctl list | grep -E "org.nixos|nix"
ls /Library/LaunchDaemons/org.nixos.*.plist
ls ~/Library/LaunchAgents/org.nixos.*.plist
Service Control
DOMAIN="system/org.nixos.<name>"
DOMAIN="gui/$(id -u)/org.nixos.<name>"
launchctl print $DOMAIN
launchctl kickstart $DOMAIN
launchctl kickstart -k $DOMAIN
launchctl kill SIGTERM $DOMAIN
sudo launchctl bootout $DOMAIN
View Plist
cat /Library/LaunchDaemons/org.nixos.<name>.plist
plutil -p /Library/LaunchDaemons/org.nixos.<name>.plist
Logs
log show --predicate 'subsystem == "org.nixos.<name>"' --last 5m
log stream --predicate 'process == "<process-name>"'
Linux (systemd)
Discovery
systemctl list-units --type=service | grep nix
systemctl --user list-units --type=service
Service Control
systemctl [--user] status <service>
systemctl [--user] start <service>
systemctl [--user] stop <service>
systemctl [--user] restart <service>
systemctl [--user] enable <service>
systemctl [--user] disable <service>
Logs
journalctl [-u <service>] [-f] [--user]
Nix Configuration
Reduce CPU priority (darwin)
launchd.user.agents.<name>.serviceConfig = {
ProcessType = "Background";
Nice = 5;
LowPriorityIO = true;
};
Disable auto-start (darwin)
launchd.daemons.<name>.serviceConfig = {
RunAtLoad = lib.mkForce false;
KeepAlive = lib.mkForce false;
};
Override existing service
Use lib.mkForce when the service module already sets values.