!PSmBFWNKoXmlQBzUQf:helsinki-systems.de

Stage 1 systemd

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

Load older messages


SenderMessageTime
20 Mar 2022
@janne.hess:helsinki-systems.de@janne.hess:helsinki-systems.de There's also a way to get around patching systemd entirely. initrd-switch-root.service calls ExecStart=systemctl --no-block switch-root /sysroot. If the second argument to systemctl is /run/current-system/systemd/lib/systemd/systemd (EXACTLY that string) or if init=/run/current-system/systemd/lib/systemd/systemd is set on the cmdline (EXACTLY that string), then the handover between the systemds works 23:21:03
@janne.hess:helsinki-systems.de@janne.hess:helsinki-systems.de * There's also a way to get around patching systemd entirely. initrd-switch-root.service calls ExecStart=systemctl --no-block switch-root /sysroot. If adding an argument to systemctl that is /run/current-system/systemd/lib/systemd/systemd (EXACTLY that string) or if init=/run/current-system/systemd/lib/systemd/systemd is set on the cmdline (EXACTLY that string), then the handover between the systemds works 23:21:20
21 Mar 2022
@elvishjerricco:matrix.org@elvishjerricco:matrix.org Janne Heß: Wouldn't it be better to simply not set environment.PATH when path == []? Like environment.PATH = mkIf (path != []) ... 00:58:19
@elvishjerricco:matrix.org@elvishjerricco:matrix.org

Yea I think this'll work:

$ git diff
diff --git a/nixos/lib/systemd-lib.nix b/nixos/lib/systemd-lib.nix
index 3129fbe7bdb..9c240f83c38 100644
--- a/nixos/lib/systemd-lib.nix
+++ b/nixos/lib/systemd-lib.nix
@@ -295,7 +295,7 @@ in rec {
     config = mkMerge
       [ { # Default path for systemd services.  Should be quite minimal.
           path = mkAfter path;
-          environment.PATH = "${makeBinPath config.path}:${makeSearchPathOutput "bin" "sbin" config.path}";
+          environment.PATH = mkIf (config.path != []) "${makeBinPath config.path}:${makeSearchPathOutput "bin" "sbin" config.path}";
         }
         (mkIf (config.preStart != "")
           { serviceConfig.ExecStartPre =

$ nix eval -f test.nix config.boot.initrd.systemd.services.foo.environment
{ }
01:00:59
@elvishjerricco:matrix.org@elvishjerricco:matrix.org Janne Heß: I've pushed something that should work. Let me know if it solves your issue 01:05:41
@elvishjerricco:matrix.org@elvishjerricco:matrix.org As for the serialization stuff, yea I think we're just going to have to switch-root to the systemd binary. And FWIW, it doesn't have to be exactly /run/current-system/systemd/lib/systemd/systemd; it has to have a canonical path that's exactly ${systemd}/lib/systemd/systemd. 01:31:49
@elvishjerricco:matrix.org@elvishjerricco:matrix.orgoh but that's going to be a problem01:32:58
@elvishjerricco:matrix.org@elvishjerricco:matrix.orgwe're using systemdMinimal... which has a different path01:33:07
@elvishjerricco:matrix.org@elvishjerricco:matrix.orgdrat01:33:13
@elvishjerricco:matrix.org@elvishjerricco:matrix.orgAnd using regular systemd instead increases the initrd size by more than double01:35:24
@janne.hess:helsinki-systems.de@janne.hess:helsinki-systems.de
In reply to @elvishjerricco:matrix.org
we're using systemdMinimal... which has a different path
That doesn't matter. If you're looking at the switch-root.c code, it compares the canonical path of the new systemd not to the path of the current systemd but rather to a constant that we set during compilation
09:31:20
@janne.hess:helsinki-systems.de@janne.hess:helsinki-systems.deThis: https://github.com/NixOS/nixpkgs/blob/master/pkgs/os-specific/linux/systemd/default.nix#L56410:08:45
@janne.hess:helsinki-systems.de@janne.hess:helsinki-systems.de bobvanderlinden: if you fix the one spelling thing in your PR, I'll merge it 10:16:04
@elvishjerricco:matrix.org@elvishjerricco:matrix.orgOh. I very much misunderstood some stuff then :P Nice!10:40:37
@janne.hess:helsinki-systems.de@janne.hess:helsinki-systems.debut you may be right that symlinks should work10:41:04
@janne.hess:helsinki-systems.de@janne.hess:helsinki-systems.deI haven't checked what same_file() does exactly10:41:13
@bobvanderlinden_:matrix.orgbobvanderlinden
In reply to @janne.hess:helsinki-systems.de
bobvanderlinden: if you fix the one spelling thing in your PR, I'll merge it
Done 👍 https://github.com/NixOS/nixpkgs/pull/164016
11:31:14
@janne.hess:helsinki-systems.de@janne.hess:helsinki-systems.deflokli was faster while I was at lunch :((12:13:43
@bobvanderlinden_:matrix.orgbobvanderlindenHaha it's merged I'm happy 👍12:39:48
@flokli:matrix.orgflokli😆13:43:09
22 Mar 2022
@elvishjerricco:matrix.org@elvishjerricco:matrix.org Janne Heß: I pushed a bunch of changes addressing several of your points. I didn't push the thing causing infinite recursion though, but it's just wrapping the existing options so why don't you try it out? 11:06:43
@janne.hess:helsinki-systems.de@janne.hess:helsinki-systems.deI will once I clear out my conflicts with your new code :D11:07:06
@janne.hess:helsinki-systems.de@janne.hess:helsinki-systems.deOkay pennae explained why it doesn't work. We won't make it work easily and since it's a temporary measure, I created this: https://github.com/NixOS/nixpkgs/commit/2aeb4967ae36bb127e3512ba6db8050edb3bedec11:32:45
@janne.hess:helsinki-systems.de@janne.hess:helsinki-systems.defeel free to pick or rebase into your changeset11:32:57
@arianvp:matrix.orgArian I wonder if nixos should have a similar policy as kubernetes. Put things in a v1alpha1 namespaced and once you move to v1beta1 all the v1alpha1 options are upserted (translated) to their v1beta1 equivalent with aliases 11:34:02
@arianvp:matrix.orgArianthat way we can signal that a module is experimental; but also not break the API per se...11:34:18
@arianvp:matrix.orgArian(Unless needed of course)11:34:23
@janne.hess:helsinki-systems.de@janne.hess:helsinki-systems.deI guess hiding the options should suffice11:34:43
@arianvp:matrix.orgArian e.g. you change. v1alpha1.initrd.mkInitrd to. v1beta1.initramfs.makeInitramfs and it gets trnslated by an alias and prints a deprecation notice or something 11:35:06
@arianvp:matrix.orgArianmaybe an interesting RFC to write :P11:35:25

Show newer messages


Back to Room ListRoom Version: 6