NixOS module system merges lists by default so if you set an option to [], that will just be a no-op. You can override the default semantics by using lib.mkForce [] instead.
Note that service configuration does not need to come from NixOS options – you can also load upstream .service files through systemd.packages option. Those options will not have values visible to nixos-option and slightly different rules apply to overriding them. Importantly, the systemd.services.<name>.* NixOS options are implemented using systemd overrides so you will need to follow systemd rules for overriding. Most notably:
- Some options like
ExecStart=accept multiple values and to clear them, you need to add an empty string[ "" ] - Dependencies (
After=, etc.) cannot be reset to an empty list at all, other than by overriding the entire unit - Similar for
WantedBy=and other options from[Install]section but those are not currently supported so they will be defined using NixOS option and easily overridable.