!PSmBFWNKoXmlQBzUQf:helsinki-systems.de

Stage 1 systemd

79 Members
systemd in NixOs's stage 1, replacing the current bash tooling https://github.com/NixOS/nixpkgs/projects/5127 Servers

Load older messages


SenderMessageTime
29 May 2023
@elvishjerricco:matrix.orgElvishJerriccono,01:32:57
@elvishjerricco:matrix.orgElvishJerricco You probably just want to do After=dev-mapper-nixos.device 01:33:20
@winterqt:nixos.devWinter (she/her)ah, yeah, that'd be better01:33:29
@elvishjerricco:matrix.orgElvishJerricco and BindsTo=dev-mapper-nixos.device 01:33:34
@elvishjerricco:matrix.orgElvishJerriccowith that combination, that's how systemd does the "waiting for device blabla..." thing01:33:53
@winterqt:nixos.devWinter (she/her)

so like this?

  boot.initrd.systemd.services.wipe-root = {
    wantedBy = [ "initrd.target" ];
    before = [ "sysroot.target" ];
    after = [ "dev-mapper-nixos.device" ];
    bindsTo = [ "dev-mapper-nixos.device" ];
    path = [ pkgs.coreutils pkgs.btrfs-progs ];
    serviceConfig.Type = "oneshot";
    script = ''
      mkdir /scratch
      mount /dev/mapper/nixos /scratch

      btrfs subvolume delete /scratch/root/srv
      btrfs subvolume delete /scratch/root/var/lib/portables
      btrfs subvolume delete /scratch/root/var/lib/machines
      btrfs subvolume delete /scratch/root

      btrfs subvolume snapshot /scratch/root-blank /scratch/root

      umount /scratch
      rm -r /scratch
    '';
  };
01:36:19
@elvishjerricco:matrix.orgElvishJerriccos/sysroot.target/sysroot.mount/01:37:04
@elvishjerricco:matrix.orgElvishJerricco * s/sysroot.target/sysroot.mount/ 01:37:06
@winterqt:nixos.devWinter (she/her)thanks.01:37:28
@elvishjerricco:matrix.orgElvishJerricco and it might be technically more correct to say requiredBy = ["sysroot.mount"]; rather than wantedBy = ["initrd.target"];? Which unit probably doesn't matter in all practicality, but wantedBy vs requiredBy just dictates whether you want failure to turn into a total stage 1 failure 01:38:10
@winterqt:nixos.devWinter (she/her)
    requiredBy = [ "sysroot.mount" ];
    # before = [ "sysroot.mount" ];
01:38:41
@winterqt:nixos.devWinter (she/her) do I need to keep before then? 01:38:46
@elvishjerricco:matrix.orgElvishJerricco still need the before. Requires dependencies don't cause runtime ordering 01:39:07
@winterqt:nixos.devWinter (she/her)got it, wasn't 100% sure01:39:29
@elvishjerricco:matrix.orgElvishJerriccoand only lead to failure if the required unit fails before the requiring unit has even started01:39:31
@winterqt:nixos.devWinter (she/her)interesting01:39:49
@elvishjerricco:matrix.orgElvishJerriccothe other difference from Wants is that if the required unit isn't present at all, the requiring unit fails01:40:17
@winterqt:nixos.devWinter (she/her)okay, last thing: how do I control what hostname is sent to the DHCP server with networkd in initrd? when using scripted stage1, i get a static lease, but with networkd, the IP... increases for whatever reason?01:40:35
@winterqt:nixos.devWinter (she/her)i think it's the hostname? no idea tho01:40:41
@elvishjerricco:matrix.orgElvishJerricco huh, can't say I've seen that behavior. But you can probably just set boot.initrd.systemd.contents."/etc/hostname".source = config.environment.etc.hostname.source; 01:41:55
@winterqt:nixos.devWinter (she/her)thanks, i'll give it a shot01:42:10
@winterqt:nixos.devWinter (she/her)
    requiredBy = [ "sysroot.mount" ];
    before = [ "sysroot.mount" ];
    after = [ "dev-mapper-nixos.device" ];
    bindsTo = [ "dev-mapper-nixos.device" ];

nothing redundant is here, right? just want to make sure before i reboot and have to rollback for the millionth time :/

01:42:51
@uep:matrix.org@uep:matrix.orgpresumably because your DHCP server is configured to use that hostname as the allocation, rather than the mac address01:43:06
@elvishjerricco:matrix.orgElvishJerricco Winter (she/her): Also, I had to do boot.initrd.systemd.network.networks.<name>.dhcpV4Config.ClientIdentifier = "mac"; because my DHCP server on my router is a systemd-networkd one, and that was the only way I could figure out to get a statically assigned IP address to the mac address 01:43:44
@elvishjerricco:matrix.orgElvishJerriccootherwise it uses some other link identifier thingy01:44:10
@uep:matrix.org@uep:matrix.orgI keep meaning to change mine to use a combination, because there are several laptops that sometimes use a certain docking station, and they all wind up with the same IP while there01:44:16
@elvishjerricco:matrix.orgElvishJerriccobut that should be stable and it should still serve the same ip address01:44:27
@elvishjerricco:matrix.orgElvishJerricco
In reply to @winterqt:nixos.dev
    requiredBy = [ "sysroot.mount" ];
    before = [ "sysroot.mount" ];
    after = [ "dev-mapper-nixos.device" ];
    bindsTo = [ "dev-mapper-nixos.device" ];

nothing redundant is here, right? just want to make sure before i reboot and have to rollback for the millionth time :/

seems fine to me
01:44:49
@winterqt:nixos.devWinter (she/her)
In reply to @uep:matrix.org
presumably because your DHCP server is configured to use that hostname as the allocation, rather than the mac address
it's using the same hostname afaict
01:44:59
@winterqt:nixos.devWinter (she/her) by this point i guess i'll just set systemd.network.enable = true ig 01:45:29

Show newer messages


Back to Room ListRoom Version: 6