!DBFhtjpqmJNENpLDOv:nixos.org

NixOS systemd

599 Members
NixOS ❤️ systemd165 Servers

Load older messages


SenderMessageTime
11 Oct 2024
@elvishjerricco:matrix.orgElvishJerricco Willi Butz: If that doc is right I don't think you need to do anything. Just put all the mounts in fileSystems, and systemd will make the sources automatically as directories. Then stage 2 tmpfiles takes care of permissions 18:19:28
@elvishjerricco:matrix.orgElvishJerriccoI need to test this now...18:19:48
@willi:butz.cloudWilli Butzah that's what I meant, there is also DirectoryMode= for mount units18:20:23
@elvishjerricco:matrix.orgElvishJerriccoyea but I think that only applies to the mountpoint, not the bind source18:20:57
@willi:butz.cloudWilli Butzah good point 18:21:16
@willi:butz.cloudWilli Butzdoing mounts first with implicit parent creation and then running regular tmpfiles sounds like a much cleaner approach 18:22:09
@emilazy:matrix.orgemily
In reply to @elvishjerricco:matrix.org

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:22:54
@emilazy:matrix.orgemilywonderful18:22:56
@willi:butz.cloudWilli Butzhttps://github.com/WilliButz/preservation/issues/5#issuecomment-240762558218:23:08
@elvishjerricco:matrix.orgElvishJerriccohm, I'm not sure it's working...18:23:14
@emilazy:matrix.orgemily that should make the module really trivial if it works right? 18:23:27
@emilazy:matrix.orgemilyit'd be lovely to get it in NixOS18:23:34
@elvishjerricco:matrix.orgElvishJerriccooh no it totally works. My test is just bad18:23:48
@emilazy:matrix.orgemilyimpermanence is like the #1 third-party module people use, so if we have a clean and simple systemd-native way to do it upstream that'd be excellent18:23:52
@aloisw:kde.orgaloiswSure it's more popular than home-manager?18:24:16
@emilazy:matrix.orgemilyhm18:24:23
@emilazy:matrix.orgemilyok, fair18:24:24
@emilazy:matrix.orgemilyI don't think of home-manager as a third-party module18:24:28
@elvishjerricco:matrix.orgElvishJerricco (but it is a lot smaller than home-manager) 18:24:34
@emilazy:matrix.orgemilyit's its entirely own… whatever you call instantiations of the module system with an activation setup18:24:40
@emilazy:matrix.orgemilywith a third-party module sitting on the side for integration18:24:46
@elvishjerricco:matrix.orgElvishJerricco

Willi Butz: Yea check it out:

with import <nixpkgs> {};

nixosTest {
  name = "foo";

  nodes.machine.virtualisation.fileSystems."/foo" = {
    device = "/bar";
    options = ["bind"];
  };

  testScript = ''
    machine.wait_for_unit("local-fs.target")
    machine.succeed("touch /bar/hi")
    machine.succeed("stat /foo/hi")
  '';
}

Totally works

18:25:04
@emilazy:matrix.orgemilyit's the #1 third-party module that solely relates to NixOS :)18:25:06
@mjm:midna.devmjm i would kind of love if services.* modules could declare their state directories, so that if you enabled preservation, it worked automatically 18:25:13
@mjm:midna.devmjm(i have something like that in my own modules)18:25:21
@mjm:midna.devmjmthat gets weird maybe if you have multiple preservation roots18:25:45
@willi:butz.cloudWilli Butz
In reply to @elvishjerricco:matrix.org

Willi Butz: Yea check it out:

with import <nixpkgs> {};

nixosTest {
  name = "foo";

  nodes.machine.virtualisation.fileSystems."/foo" = {
    device = "/bar";
    options = ["bind"];
  };

  testScript = ''
    machine.wait_for_unit("local-fs.target")
    machine.succeed("touch /bar/hi")
    machine.succeed("stat /foo/hi")
  '';
}

Totally works

nice! I'll see if I can rework the module soonish
18:25:49
@emilazy:matrix.orgemilyisn't that what the systemd state directory stuff is for?18:25:52
@emilazy:matrix.orgemilybut also I thought part of the idea was that it should be opt-in what you actually preserve18:26:06
@emilazy:matrix.orgemilysince lots of stuff has state18:26:08

Show newer messages


Back to Room ListRoom Version: 6