!PSmBFWNKoXmlQBzUQf:helsinki-systems.de

Stage 1 systemd

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

Load older messages


SenderMessageTime
2 May 2023
@arianvp:matrix.orgArianthough i do think it can be a matter of opinion https://github.com/systemd/systemd/blame/main/units/systemd-repart.service.in#L2521:02:47
@arianvp:matrix.orgArian upstream runs after /sysusr is mounted (which will become /usr after switchroot) so it definitely expects the main software to already be mounted and only add additional partitions for storage not software 21:03:29
@arianvp:matrix.orgArian I think for us that'd mean run before root but after nix.mount 21:03:52
@arianvp:matrix.orgArian I think that makes sense for the nixos case if /nix is on separate partition 21:05:10
@arianvp:matrix.orgArianbut not sure....21:05:19
@elvishjerricco:matrix.org@elvishjerricco:matrix.org Arian: Yea I was looking into this last night, and there isn't really a clean answer without patching systemd or something. It really expects at least an OS to be installed on a disk, but in NixOS we go even further and don't even have an OS on a disk. The other thing is that we actually can't just use /sysroot; we would have to wait for nixos-activation.service to run so that /etc is set up 21:19:39
@arianvp:matrix.orgArian I think doing systemd-repart --empty=allow /dev/vda is the way to go 21:20:17
@arianvp:matrix.orgArianfor nixos21:20:24
@arianvp:matrix.orgArianthat will re-partition the disk even if it doesnt have a GPT partition table21:20:42
@arianvp:matrix.orgArianand run that in initrd21:20:59
@elvishjerricco:matrix.org@elvishjerricco:matrix.org Yea, I'm really starting to think that the only sane option is to put the config files in the initrd and do systemd-repart --empty=allow ${config.fileSystems."/".device} except that isn't quite right because we have to point at the root disk, not the root partition 21:22:27
@elvishjerricco:matrix.org@elvishjerricco:matrix.org Which makes me think we actually need a boot.initrd.systemd.repart.device option 21:23:21
@arianvp:matrix.orgArianboot.initrd.systemd/repart.device21:23:25
@arianvp:matrix.orgArianyeh21:23:29
@arianvp:matrix.orgArianexactly21:23:30
@elvishjerricco:matrix.org@elvishjerricco:matrix.org But that's super lame because we don't need to do that for boot.initrd.growPartition, which I was hoping to implement in systemd-initrd via repart 21:23:58
@elvishjerricco:matrix.org@elvishjerricco:matrix.org * But that's super lame because we don't need to do that for boot.growPartition, which I was hoping to implement in systemd-initrd via repart 21:24:14
@elvishjerricco:matrix.org@elvishjerricco:matrix.org but growPartition just assumes you've set fileSystems."/".device to something with a number at the end that can be dropped to get to the disk 21:24:49
@arianvp:matrix.orgArianwell we can still implement that as a compatibiliy hack?21:25:31
@elvishjerricco:matrix.org@elvishjerricco:matrix.org Yea I guess we can move the number-dropping logic out of shell script and into nix code and set boot.initrd.systemd.repart.device with that 21:26:05
@arianvp:matrix.orgArianexactly21:26:17
@arianvp:matrix.orgArian

having nixos-install call systemd-repart would be nice too.

have nixos-install --flake github:arianvp#mymachine just work would be kinda magical

21:26:54
@elvishjerricco:matrix.org@elvishjerricco:matrix.orgoh that's a cool idea21:27:22
@arianvp:matrix.orgArianI now do this: https://github.com/arianvp/nixos-stuff/blob/master/configs/utm/install.sh21:27:45
@elvishjerricco:matrix.org@elvishjerricco:matrix.orgSo one slightly crazier idea than parsing device file names with nix would be to go nuts with udev21:29:05
@elvishjerricco:matrix.org@elvishjerricco:matrix.org i.e. set up a udev rule that waits for fileSystems."/".device and creates a /dev/repart-actual-root-node symlink that points to the parent-most device of that device 21:30:00
@elvishjerricco:matrix.org@elvishjerricco:matrix.orgoh but that does expect the root partition to at least exist already21:30:24
@elvishjerricco:matrix.org@elvishjerricco:matrix.orgso nevermind21:30:27
@elvishjerricco:matrix.org@elvishjerricco:matrix.org Arian: Anyway, I think the only other thing we could really do besides a boot.initrd.repart.device option would be to repurpose /sysusr for /nix/store (which is kind of morally correct anyway tbh), and and pull the system's toplevel store path from the init= parameter like we doinnixos-activation.servicein order to find repart definitions. The big advantage here is that the root device would be derived from the backing device of/sysusr/usr(which we would hack up to be derived from/sysusr/nix/store), so that we don't need an explicit device to be set. But that does mean your /nix/store` has to be on a partition on your root disk, and can't be something fancy like a 9p file system or something 21:36:37
@elvishjerricco:matrix.org@elvishjerricco:matrix.org * Arian: Anyway, I think the only other thing we could really do besides a boot.initrd.repart.device option would be to repurpose /sysusr for /nix/store (which is kind of morally correct anyway tbh), and and pull the system's toplevel store path from the init= parameter like we do innixos-activation.servicein order to find repart definitions. The big advantage here is that the root device would be derived from the backing device of/sysusr/usr(which we would hack up to be derived from/sysusr/nix/store), so that we don't need an explicit device to be set. But that does mean your /nix/store\ has to be on a partition on your root disk, and can't be something fancy like a 9p file system or something 21:37:01

Show newer messages


Back to Room ListRoom Version: 6