Open kr-nn opened 3 months ago
In short, you can't: the NixOS module only configures the system-wide service; the user service unit is provided by the upstream project and installed as-is. The latter is meant to be configured imperatively.
If you want you can run the system-wide service under your user and still configure declaratively from NixOS. home-manager has a syncthing module if you want to configure both independently.
You could probably also inherit the config as needed from config.systemd.services.syncthing.serviceConfig
, I haven't tested that out though (and of course you'll have to not inherit settings unsupported by user services).
I mean the user service is "System-Wide" its not ~/.config/systemd. Its /etc/systemd
All users can use the /etc/systemd/user/syncthing.service
The nixos module does allow configuring these user services. Right now I'm taking advantage of systemd.user.units.syncthing.text as a workaround.
Yeah we probably will eventually want a more "portable" services framework but for now we're sticking to configuring system services primarily. Not just for syncthing, but just about any NixOS module really.
I think /etc/systemd/user is a system level config. Unprivileged users can't edit it, but they can take advantage of it without declaring it in home manager.
For my use case I'm trying to avoid using the home manager module, because by name home-manager manages /home which I think /etc should be a nixos responsibility.
For ex. If I'm a sysadmin for a corporation and I'm making a bunch of devs use nixos I can enforce the user service for them if needed without adding a second input.
What I'm saying is, NixOS modules generally configure systemd.services.<whatever>
not systemd.user.services.<whatever>
. If we want to configure both, or even allow for configuring both, IMO it should be done the same way for all the modules (that it might apply to) rather than ad-hoc kludge added to individual services.
When I configure services.syncthing it works as intended but I would like to instead of using the system service, enable user services. But if for ex. I set guiAddress = "0.0.0.0:8384" the user service is still set to 127.0.0.1:8384
Steps:
services.syncthing = { enable = true; guiAddress = "0.0.0.0:8483" };
The user services should still be configurable in services.syncthing.X
@Denperidge