!DBFhtjpqmJNENpLDOv:nixos.org

NixOS systemd

599 Members
NixOS ❤️ systemd165 Servers

Load older messages


SenderMessageTime
11 Oct 2024
@elvishjerricco:matrix.orgElvishJerricco because /persist will be created automatically by systemd when mounting it 18:06:23
@emilazy:matrix.orgemilywithout an activation script at least?18:06:23
@emilazy:matrix.orgemilymaybe I misunderstand though18:06:26
@emilazy:matrix.orgemily
In reply to @elvishjerricco:matrix.org
because /persist will be created automatically by systemd when mounting it
right ok
18:06:38
@emilazy:matrix.orgemilyI see what you mean now18:06:50
@elvishjerricco:matrix.orgElvishJerricco the issue is if the /persist FS doesn't already have the /foo subdir 18:06:57
@emilazy:matrix.orgemilyI think it is too much to ask people to do manual setup like that though18:06:59
@emilazy:matrix.orgemily it means you have effectively unencoded mkdir /persist/… steps in your configuration 18:07:12
@emilazy:matrix.orgemilythe temptation will be to write another gross activation script to deal with this18:07:21
@emilazy:matrix.orgemilyit is not very declarative18:07:26
@emilazy:matrix.orgemilyit also means that setting up any new service with state requires manual intervention beyond just deploying a configuration18:07:46
@emilazy:matrix.orgemilywhich is worse than standard NixOS18:07:52
@mjm:midna.devmjmhmm i guess that's true18:08:15
@elvishjerricco:matrix.orgElvishJerricco
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:matrix.orgElvishJerricco(I really wish systemd would still respect ordering of already-started units...)18:09:22
@willi:butz.cloudWilli Butzthe 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 reboots18:10:13
@mjm:midna.devmjmand 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:matrix.orgElvishJerricco 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:matrix.orgElvishJerriccojust because of the semantics of those targets18:12:04
@elvishjerricco:matrix.orgElvishJerricco * 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.cloudWilli 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:matrix.orgElvishJerricco
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.cloudWilli Butzhmm, 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 stage18:16:49
@elvishjerricco:matrix.orgElvishJerricco because unfortunately we can't replicate that with fileSystems / fstab to my knowledge 18:16:53
@elvishjerricco:matrix.orgElvishJerriccowait a sec18:17:37
@elvishjerricco:matrix.orgElvishJerriccowtf18:17:43
@elvishjerricco:matrix.orgElvishJerricco

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:matrix.orgElvishJerricco so it does create the sources??? 18:18:22
@willi:butz.cloudWilli ButzI could also flip the current setup, keep custom mount units but set them up before tmpfiles18:18:25
@elvishjerricco:matrix.orgElvishJerriccosince when?18:18:25

Show newer messages


Back to Room ListRoom Version: 6