NixOS uses the systemd overrides file (i.e what you get when you do
systemctl edit xxx.service
). You can see which files are used and what's
overriden by doing systemctl cat xxx.service
.
In my case I've been having issues with NetworkManager-wait-online
during
nixos rebuilds that fails because the network is restarting. It's quite useless
in that case so I wanted to override it to not fail.
But since ExecStart
is an additive property (as Environment
) we can't
override it by just doing :
systemd.services.NetworkManager-wait-online.serviceConfig.ExecStart = lib.mkForce "-${pkgs.networkmanager}/bin/nm-online";
This will just add another property.
To Reset
(in systemd speech) we need to add an empty ExecStart
and then our
custom one.
This can be done the following way :
systemd.services.NetworkManager-wait-online.serviceConfig.ExecStart = lib.mkForce [ "" "-${pkgs.networkmanager}/bin/nm-online" ];
Farewell!