I have a NixOS system installed on a tmpfs with a btrfs partition for persisting important system state. I am trying to set up syncthing, but it seems like no matter what I do, my system’s identifier changes after I reboot.
services.syncthing.dataDir to my home directory and I used the impermanence module to persist the directory I have set as
services.syncthing.configDir (and the directories I wish to sync, of course). I am having difficulty figuring out what other files, if any I need to persist for Syncthing to work properly.
Any help would be greatly appreciated.
It seems like if I restart
syncthing-init.service, my old identifier comes back when viewing to
localhost:8384 in a browser, but when I reboot, it changes to a random one for some reason. It looks like on a fresh reboot,
syncthing-init.service runs into permission errors, although I don’t quite know with what. Also, I tried persisting /run/syncthing-init, but idk if that is necessary or helping or not.
I’m just guessing, but this is likely what is happening: syncthing runs as a system user and starts before your home partition is mounted, so it creates a new keypair every time. If you restart the service, with the partition mounted, it re-reads the configuration and works normally.
That makes sense. Since that’s probably the problem, I tried switching to using home-manager to configure it to see if it would fix it and it looks like it works fine now.
If you want to keep using the NixOS module you could mark you home partition as needed for boot, but home-manager is probably the better solution.
Thanks you for the suggestion, but the issue with that is that my persistent partition isn’t my home directory. My home directory itself is on the tmpfs.
My persistent partiton is located at /persist and relies on the impermanence module to bind mount directories within it to their corresponding locations throughout my system, including various places in my home directory.
Also, I already have /persist marked at needed for boot because I use it to store password hash files so I can persistently set passwords with
to bind mount directories …
Impermanence seems to be creating services called
persist-some-path to do this. So, it should be possible to add
after dependency to