I installed the Nix package manager on XUbuntu 20.04. It added a nix-daemon
service. I would like to start the nix-daemon
service on boot. If I type the following commands the service runs and works fine until I halt the machine, but after a reboot the service is not running, and I need to run these commands again.
It seems that systemd disables the service or forgets that it was enabled. How can I tell systemd to enable the service and leave it enabled?
$ sudo systemctl status nix-daemon
Unit nix-daemon.service could not be found.
$ sudo systemctl enable nix-daemon
$ sudo systemctl status nix-daemon
● nix-daemon.service - Nix Daemon
Loaded: loaded (/nix/store/4vz8sh9ngx34ivi0bw5hlycxdhvy5hvz-nix-2.3.7/lib/systemd/system/nix-daemon.service; enabled; vendor preset: enabled)
Drop-In: /etc/systemd/system/nix-daemon.service.d
└─override.conf
Active: inactive (dead)
TriggeredBy: ● nix-daemon.socket
$ sudo service nix-daemon start
● nix-daemon.service - Nix Daemon
Loaded: loaded (/nix/store/4vz8sh9ngx34ivi0bw5hlycxdhvy5hvz-nix-2.3.7/lib/systemd/system/nix-daemon.service; enabled; vendor preset: enabled)
Drop-In: /etc/systemd/system/nix-daemon.service.d
└─override.conf
Active: active (running) since Fri 2021-04-16 04:35:15 BST; 2s ago
TriggeredBy: ● nix-daemon.socket
Main PID: 55329 (nix-daemon)
Tasks: 5 (limit: 9091)
Memory: 13.8M
CGroup: /system.slice/nix-daemon.service
└─55329 nix-daemon --daemon
Apr 16 04:35:15 wayfire systemd[1]: Started Nix Daemon.
Apr 16 04:35:15 wayfire nix-daemon[55329]: warning: unknown setting 'experimental-features'
Apr 16 04:35:15 wayfire nix-daemon[55329]: warning: unknown setting 'keep-derivarions'
EDIT:
Contents of the /etc/systemd/system/nix-daemon.service
that was created by the installer (I didn't modify it):
[Unit]
Description=Nix Daemon
RequiresMountsFor=/nix/store
RequiresMountsFor=/nix/var
ConditionPathIsReadWrite=/nix/var/nix/daemon-socket
[Service]
ExecStart=@/nix/store/4vz8sh9ngx34ivi0bw5hlycxdhvy5hvz-nix-2.3.7/bin/nix-daemon nix-daemon --daemon
KillMode=process
[Install]
WantedBy=multi-user.target
There is no /etc/default/nix file.
$ systemctl get-default
graphical.target