summary refs log tree commit diff
path: root/pkgs/os-specific/linux/systemd/0016-inherit-systemd-environment-when-calling-generators.patch
diff options
context:
space:
mode:
authorДамјан Георгиевски <gdamjan@gmail.com>2023-02-17 18:03:01 +0100
committerДамјан Георгиевски <gdamjan@gmail.com>2023-03-05 04:35:34 +0100
commit575fddf25b672b8ed5d5294ab10a8a22d579bc3b (patch)
tree2ab7dcf45cc781e5a9b8a0dac05e22c9ecae209e /pkgs/os-specific/linux/systemd/0016-inherit-systemd-environment-when-calling-generators.patch
parentfb96f99cce403d2012f7353f6691aa91f7462b2c (diff)
downloadnixpkgs-575fddf25b672b8ed5d5294ab10a8a22d579bc3b.tar
nixpkgs-575fddf25b672b8ed5d5294ab10a8a22d579bc3b.tar.gz
nixpkgs-575fddf25b672b8ed5d5294ab10a8a22d579bc3b.tar.bz2
nixpkgs-575fddf25b672b8ed5d5294ab10a8a22d579bc3b.tar.lz
nixpkgs-575fddf25b672b8ed5d5294ab10a8a22d579bc3b.tar.xz
nixpkgs-575fddf25b672b8ed5d5294ab10a8a22d579bc3b.tar.zst
nixpkgs-575fddf25b672b8ed5d5294ab10a8a22d579bc3b.zip
systemd: 252.5 -> 253
systemd v253 changelog/NEWS:
https://github.com/systemd/systemd/blob/v253/NEWS

NixOS changes:
0007-hostnamed-localed-timedated-disable-methods-that-cha.patch was
dropped, because systemd gained support to handle read-only /etc.

*-add-rootprefix-to-lookup-dir-paths.patch required some updates too,
as src/basic/def.h moved to src/basic/constants.h.

systemd/systemd#25771 switched p11kit to become
dlopen()'ed, so we need to patch that path.

added a note to the 23.05 release notes to recommend `nixos-rebuild boot`

Co-authored-by: Florian Klink <flokli@flokli.de>
Diffstat (limited to 'pkgs/os-specific/linux/systemd/0016-inherit-systemd-environment-when-calling-generators.patch')
-rw-r--r--pkgs/os-specific/linux/systemd/0016-inherit-systemd-environment-when-calling-generators.patch39
1 files changed, 39 insertions, 0 deletions
diff --git a/pkgs/os-specific/linux/systemd/0016-inherit-systemd-environment-when-calling-generators.patch b/pkgs/os-specific/linux/systemd/0016-inherit-systemd-environment-when-calling-generators.patch
new file mode 100644
index 00000000000..1cfd939a639
--- /dev/null
+++ b/pkgs/os-specific/linux/systemd/0016-inherit-systemd-environment-when-calling-generators.patch
@@ -0,0 +1,39 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Yuriy Taraday <yorik.sar@gmail.com>
+Date: Fri, 17 Jun 2022 12:45:10 +0000
+Subject: [PATCH] inherit systemd environment when calling generators.
+
+Systemd generators need access to the environment configured in
+stage-2-init.sh since it schedules fsck and mkfs executions based on
+being able to find an appropriate binary for the target filesystem.
+
+With this commit I am altering the systemd behaviour since upstream
+tries to gather environments with that they call
+"environment-generators" and then seems to pass that on to all the other
+executables that are being called from managers.
+---
+ src/core/manager.c | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/src/core/manager.c b/src/core/manager.c
+index 50d092042c..898f9ed2f1 100644
+--- a/src/core/manager.c
++++ b/src/core/manager.c
+@@ -3714,9 +3714,17 @@ static int build_generator_environment(Manager *m, char ***ret) {
+          * adjust generated units to that. Let's pass down some bits of information that are easy for us to
+          * determine (but a bit harder for generator scripts to determine), as environment variables. */
+ 
++        // On NixOS we must propagate PATH to generators so they are
++        // able to find binaries such as `fsck.${fstype}` and
++        // `mkfs.${fstype}`. That is why we ignore transient_environment that
++        // overrides the PATH variable. This propagates systemd's
++        // environment (e.g. PATH) that was setup
++        // before calling systemd from stage-2-init.sh.
++#if 0
+         nl = strv_copy(m->transient_environment);
+         if (!nl)
+                 return -ENOMEM;
++#endif
+ 
+         r = strv_env_assign(&nl, "SYSTEMD_SCOPE", MANAGER_IS_SYSTEM(m) ? "system" : "user");
+         if (r < 0)