Good morning,
i am curious how i can delay a service with nix. Usually i assign the ip address to my ssh configuration, and it make fail at boot; this does happen to any distro i used before. So i usually modify the ssh.service, and it solve the problem.
I added this lines to my .nix file, the rebuild don’t give me any error, but seem not working as expected.
Build not fail, but ssh still down after a reboot; have to manually restart it. Don’t know if the preStart line fit my configuration with XFCE and network manager.
First of all, NixOS does not manage your services directly, it instructs systemd to do it. This is therefore a purely systemd-specific question and has nothing to do with Nix. I’d recommend you to ask in generic Linux forums how to achieve your goal and then here if you need help transferring the generic solution into a NixOS declaration.
Please clarify what exactly you mean by that, it is not clear to me.
“modify” in what way?
Did those lines come into effect in the relevant unit file? I’m pretty sure the ssh daemon service is sshd.service on NixOS, not openssh.service.
Generally speaking, you should explicitly depend on the specific things you need to have “up” by encapsulating the “things you need up” as systemd units.
If this is related to network configuration, you probably want to use systemd-networkd to configure the network because it automatically generates .link units on which you can then make other units (such as sshd) depend.
The problem with OpenSSH and Network Manager always been the same. If specify the listen IP address, and Network Manager is not up yet, it fail to start. For solve this problem usually i add 2 lines to the sshd.service in the systemd folder (not always the same location in every distro)