Start services on boot (nextcloud, syncthing)

I’m currently evaluating several services for my home-cloud setup. So I’m entering new NixOS grounds, as so far I’ve only used it for Desktops.

I just realized that several services, though not running as my user, only run after I login to KDE Plasma. They don’t stop when I log out. But I’d rather have it such that my gf just has to hit the power button when I’m not home, and everything comes up.

So I wonder if there are config options for nextcloud and syncthing in particular, or “services” in general, to make them start before anybody logs in to the graphical user interface. I would have expected this to be the default (who expects a cloud service to wait for some “random” login?!), but apparently, it’s not so. Why?

It seems that systemd.services.<service-name>.wantedBy = [ "multi-user.target" ]; does the job

Are you not using the nixos options for those services? A nixos module generally will add wantedBy = ["multi-user.target"];, like syncthing does here. And more importantly, it does not make sense that they would start later, like after you log in; there’s nothing that would start it at all other than something like wantedBy = ["multi-user.target"];

2 Likes

My experience is that, no, nextcloud and syncthing does not start at boot. The do if I add the multi-user.target. Unless something freakish got into my way

I would urge you to root cause the problem, because what you’re describing is not consistent with how it should be working.

1 Like

You’re right. It seems it’s flaky. I’ve removed my extra config, and right now it works after boot without login. Before, even with my changes, it wasn’t working. Even ssh wasn’t there. I’ll monitor this

Holy crap. The services are stopped when I close the laptop lid. Or firewall comes up. Not sure. Anyway, that happens without the device going to sleep

Did you figure it out, @mvb?

Haven’t looked into it. Keeping the lid open for now :sweat_smile:

Sharing your config might make others more inclined to try to help.

I don’t think there anything special about my config in that regard, plus it’s rather huge and contains some things I cannot make public. I do think by now that the actual problem is the network being cut when the lid is closed. Stills seems quite dumb, but that’s how it is. Don’t have the time to look into it rn, though :confused:

1 Like