!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/5129 Servers

Load older messages


SenderMessageTime
16 Mar 2022
@bobvanderlinden_:matrix.orgbobvanderlinden * Janne Heß: Indeed. I also realized that it could take a long time before everyone agrees on all the changes that I have made in #164016. That is why I split off the most important change to https://github.com/NixOS/nixpkgs/pull/164317. I can keep working on making initramfs's systemd as nice and reusable as possible. Since it will be under a boot.initramfs.systemd.enable-option it'll be easier to merge already. Once it is settled that the reusable parts are indeed the right way to go, we can slowly merge them into the systemd and systemd.user modules. 19:08:43
@janne.hess:helsinki-systems.de@janne.hess:helsinki-systems.de invited @mic92:nixos.devMic92.19:17:02
@mic92:nixos.devMic92 joined the room.19:17:12
19 Mar 2022
@bobvanderlinden_:matrix.orgbobvanderlinden

ElvishJerricco: my branch where I worked on your work is here: https://github.com/bobvanderlinden/nixpkgs/commits/rewrite-initrd-systemd
the most notable things I did:

  • Merged nixos-unstable and made sure things are working again
  • Renamed the make-initramfs-ng tool to find-dependencies. Now it doesn't copy files, but solely output paths for cpio's stdin. This should make it a bit faster.
  • Added functionality to find /nix/store/XXX paths in non-ELF files. So it can recursively find dependencies in config files (like .service files).
  • Make sure the nixos/tests/systemd.nix succeeded.
  • Moved everything from nixos/modules/boot/stage-1.nix into nixos/modules/boot/initramfs/default.nix and nixos/modules/boot/initramfs/systemd/default.nix. This reverted stage-1.nix back to its original content, so that boot.initrd.enable can work. This adds boot.initramfs.enable and boot.initramfs.systemd.enable.
09:25:08
@elvishjerricco:matrix.org@elvishjerricco:matrix.orgOh boy, I've got some catching up to do...09:26:33
@elvishjerricco:matrix.org@elvishjerricco:matrix.org bobvanderlinden: TBH I've basically restarted again to heavily clean up the module API so that it's almost just boot.initrd.systemd.objects and boot.initrd.systemd.<unit-type> 09:27:25
@bobvanderlinden_:matrix.orgbobvanderlindenthat is mostly where I left off. The next thing I was working on was to remove systemd-units.nix and reuse the units, services, mounts from nixos/modules/boot/systemd.nix. That's why I was refactoring nixos/modules/boot/systemd.nix in a separate PR.09:27:49
@elvishjerricco:matrix.org@elvishjerricco:matrix.org Plus switching to an enable thing so that you can choose between old initrd (default) and systemd initrd 09:27:52
@elvishjerricco:matrix.org@elvishjerricco:matrix.org bobvanderlinden: Yea that's what I'm doing literally right now on my branch 09:28:17
@bobvanderlinden_:matrix.orgbobvanderlindenyes, that was a good step to take. However, since we reworked the way initrd (aka initramfs) is being built, I gathered it might be safer to move that also to a separate option.09:29:37
@bobvanderlinden_:matrix.orgbobvanderlindenreusable systemd can be found here: https://github.com/bobvanderlinden/nixpkgs/commits/pr-reusable-systemd-module09:29:49
@bobvanderlinden_:matrix.orgbobvanderlindenI wanted to do that in stages, so that it will be easier to merge for people ☝️09:30:31
@bobvanderlinden_:matrix.orgbobvanderlindenMoving systemd helper functions to systemd-lib.nix: https://github.com/NixOS/nixpkgs/pull/164317 Split up systemd.nix into systemd/{user,journald,coredump,...}.nix: https://github.com/NixOS/nixpkgs/pull/16401609:31:51
@elvishjerricco:matrix.org@elvishjerricco:matrix.orgwait... is your version of the rust program copying any nix path to show up in any file?09:32:02
@elvishjerricco:matrix.org@elvishjerricco:matrix.orgThat's very likely to be excessive09:32:15
@bobvanderlinden_:matrix.orgbobvanderlindenno, it only outputs to stdout the paths of the /nix/store/* files09:32:42
@bobvanderlinden_:matrix.orgbobvanderlindenthe tool doesn't write to files/directories anymore09:33:06
@elvishjerricco:matrix.org@elvishjerricco:matrix.org bobvanderlinden: Sure, but that's not what I meant 09:34:19
@elvishjerricco:matrix.org@elvishjerricco:matrix.org it's just searching for any /nix/store/XXXXXXX... path in any file and adding that to the list, right? 09:34:34
@bobvanderlinden_:matrix.orgbobvanderlindenah, yes, if it is not an ELF file, it will do that. I gathered it can be optimized a bit by detecting a text-file for instance09:35:20
@bobvanderlinden_:matrix.orgbobvanderlinden * ah, yes, if it is not an ELF file, it will do that. I gathered it can be optimized a bit by detecting a text-file for instance, but I haven't implemented that yet.09:35:38
@elvishjerricco:matrix.org@elvishjerricco:matrix.orgHmm... I dunno whether or not that's a good idea09:35:39
@elvishjerricco:matrix.org@elvishjerricco:matrix.orgIt could definitely lead to excessive inclusions09:35:51
@elvishjerricco:matrix.org@elvishjerricco:matrix.organd initramfs really needs to be lean09:36:03
@elvishjerricco:matrix.org@elvishjerricco:matrix.orgNot even close to as bad as copying whole nix closure of course, but I'd be curious to know if it tends to make the initramfs noticeably bigger09:36:55
@bobvanderlinden_:matrix.orgbobvanderlinden Well, the idea was that if you refer to files in initramfs.systemd.services (directly or indirectly), it'll copy those automatically. You only need to add things to initramfs.contents if those files were missed. That shouldn't happen that often. 09:37:32
@elvishjerricco:matrix.org@elvishjerricco:matrix.orgyea, I was going to add stuff specifically for parsing Exec* options in service files to make sure it was as minimal as possible, rather than just any referenced path09:38:14
@bobvanderlinden_:matrix.orgbobvanderlinden I see that as an optimization ;) it's good to do so. My solution is crude indeed, but it does get the job done, also for things like initramfs.systemd.services.myservice.script = "... ${somePackage}/bin/something ..."; where ExecStart refers to a bash script, that refers to a bin file. It can go deep I guess 😅 09:40:43
@elvishjerricco:matrix.org@elvishjerricco:matrix.orgwe'll have to play with it and see the size consequences09:41:35
@bobvanderlinden_:matrix.orgbobvanderlindenThe initramfs of mine was 30M last time I ran it09:41:56

Show newer messages


Back to Room ListRoom Version: 6