| 20 Mar 2022 |
@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 | * 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 | 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 | 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 | Janne Heß: I've pushed something that should work. Let me know if it solves your issue | 01:05:41 |
@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 | oh but that's going to be a problem | 01:32:58 |
@elvishjerricco:matrix.org | we're using systemdMinimal... which has a different path | 01:33:07 |
@elvishjerricco:matrix.org | drat | 01:33:13 |
@elvishjerricco:matrix.org | And using regular systemd instead increases the initrd size by more than double | 01:35:24 |
@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 | This: https://github.com/NixOS/nixpkgs/blob/master/pkgs/os-specific/linux/systemd/default.nix#L564 | 10:08:45 |
@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 | Oh. I very much misunderstood some stuff then :P Nice! | 10:40:37 |
@janne.hess:helsinki-systems.de | but you may be right that symlinks should work | 10:41:04 |
@janne.hess:helsinki-systems.de | I haven't checked what same_file() does exactly | 10:41:13 |
bobvanderlinden | 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 | flokli was faster while I was at lunch :(( | 12:13:43 |
bobvanderlinden | Haha it's merged I'm happy 👍 | 12:39:48 |
flokli | 😆 | 13:43:09 |
| 22 Mar 2022 |
@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 | I will once I clear out my conflicts with your new code :D | 11:07:06 |
@janne.hess:helsinki-systems.de | Okay 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/2aeb4967ae36bb127e3512ba6db8050edb3bedec | 11:32:45 |
@janne.hess:helsinki-systems.de | feel free to pick or rebase into your changeset | 11:32:57 |
Arian | 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 |
Arian | that way we can signal that a module is experimental; but also not break the API per se... | 11:34:18 |
Arian | (Unless needed of course) | 11:34:23 |
@janne.hess:helsinki-systems.de | I guess hiding the options should suffice | 11:34:43 |
Arian | 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 |
Arian | maybe an interesting RFC to write :P | 11:35:25 |