11 Oct 2024 |
ElvishJerricco | because /persist will be created automatically by systemd when mounting it | 18:06:23 |
emily | without an activation script at least? | 18:06:23 |
emily | maybe I misunderstand though | 18:06:26 |
emily | In reply to @elvishjerricco:matrix.org because /persist will be created automatically by systemd when mounting it right ok | 18:06:38 |
emily | I see what you mean now | 18:06:50 |
ElvishJerricco | the issue is if the /persist FS doesn't already have the /foo subdir | 18:06:57 |
emily | I think it is too much to ask people to do manual setup like that though | 18:06:59 |
emily | it means you have effectively unencoded mkdir /persist/… steps in your configuration | 18:07:12 |
emily | the temptation will be to write another gross activation script to deal with this | 18:07:21 |
emily | it is not very declarative | 18:07:26 |
emily | it also means that setting up any new service with state requires manual intervention beyond just deploying a configuration | 18:07:46 |
emily | which is worse than standard NixOS | 18:07:52 |
mjm | hmm i guess that's true | 18:08:15 |
ElvishJerricco | In reply to @emilazy:matrix.org it also means that setting up any new service with state requires manual intervention beyond just deploying a configuration I actually don't even know if nixos-rebuild switch will properly start new services after mounting new bind mounts... but that's a separate issue | 18:08:42 |
ElvishJerricco | (I really wish systemd would still respect ordering of already-started units...) | 18:09:22 |
Willi Butz | the idea is to have something that works from first boot. so it shouldn't make a difference whether I boot the config with persisted state or on a fresh install, the mounts and symlinks should point to the place where the selected state is preserved across reboots | 18:10:13 |
mjm | and the normal tmpfiles setup services are ordered after local-fs/initrd-fs and that's why you can't use those, right? | 18:15:41 |
ElvishJerricco | Willi Butz: Yea, so if you want the persistent source directories to be created automatically then you probably want a custom tmpfiles service that uses --prefix=/persist and ordered after persistent mounts and before bind mounts. But all of this needs to be pre-local-fs/initrd-fs | 18:11:49 |
ElvishJerricco | just because of the semantics of those targets | 18:12:04 |
ElvishJerricco | * Willi Butz: Yea, so if you want the persistent source directories to be created automatically then you probably want a custom tmpfiles service that uses --prefix=/persist and ordered after persistent mounts and before bind mounts. But all of this needs to be before local-fs/initrd-fs | 18:12:58 |
Willi Butz | @elvishjerricco:matrix.org maybe I misunderstood you earlier with the fstab / fileSystems reference. To me that approach would seem much more trivial than currently, setting up the bindmounts as like all the other mounts and then running tmpfiles to setup permissions + missing symlinks and target files sounds like it does everything I need
| 18:15:18 |
ElvishJerricco | In reply to @willi:butz.cloud
@elvishjerricco:matrix.org maybe I misunderstood you earlier with the fstab / fileSystems reference. To me that approach would seem much more trivial than currently, setting up the bindmounts as like all the other mounts and then running tmpfiles to setup permissions + missing symlinks and target files sounds like it does everything I need
It sounds to me like the issue is that if I want /persist/foo bind mounted to /foo , then you need to ensure that /persist/foo exists, and you were using tmpfiles to create /persist/foo . Is that right? | 18:16:17 |
Willi Butz | hmm, not sure how to do permissions though. that needs all the user information so it would be hard figure out in initrd and that would mean doing this once per stage | 18:16:49 |
ElvishJerricco | because unfortunately we can't replicate that with fileSystems / fstab to my knowledge | 18:16:53 |
ElvishJerricco | wait a sec | 18:17:37 |
ElvishJerricco | wtf | 18:17:43 |
ElvishJerricco | in systemd.mount 's section on What= :
If this mount is a bind mount and the specified path does not exist yet it is created as directory.
| 18:18:08 |
ElvishJerricco | so it does create the sources??? | 18:18:22 |
Willi Butz | I could also flip the current setup, keep custom mount units but set them up before tmpfiles | 18:18:25 |
ElvishJerricco | since when? | 18:18:25 |