From 94ff2f02a40db7469e78f1e07b509a1ed63433d3 Mon Sep 17 00:00:00 2001 From: dramforever Date: Sat, 11 Jul 2026 22:24:21 +0800 Subject: [PATCH 1/2] systemd: Fix path to find_program('clang', ...) replacement Systemd 261 moved the location of this call, which means that this replacement was lost, which broke cross compilation. See https://github.com/systemd/systemd/commit/e6fc73350f9485064302e687b964f70b28b2e4f6 --- pkgs/os-specific/linux/systemd/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/os-specific/linux/systemd/default.nix b/pkgs/os-specific/linux/systemd/default.nix index eab1a27055ec..f7fefd8110f7 100644 --- a/pkgs/os-specific/linux/systemd/default.nix +++ b/pkgs/os-specific/linux/systemd/default.nix @@ -248,7 +248,7 @@ stdenv.mkDerivation (finalAttrs: { substituteInPlace src/basic/path-util.h --replace "@defaultPathNormal@" "${placeholder "out"}/bin/" '' + lib.optionalString withLibBPF '' - substituteInPlace meson.build \ + substituteInPlace src/bpf/meson.build \ --replace "find_program('clang'" "find_program('${stdenv.cc.targetPrefix}clang'" '' + lib.optionalString withUkify '' From 2a0fe99286c94917de66955dd83d6620098a50bc Mon Sep 17 00:00:00 2001 From: dramforever Date: Sat, 11 Jul 2026 20:34:44 +0800 Subject: [PATCH 2/2] systemd: substituteInPlace --replace-fail everywhere This will catch if any of these replacement targets gets moved around again. --- pkgs/os-specific/linux/systemd/default.nix | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pkgs/os-specific/linux/systemd/default.nix b/pkgs/os-specific/linux/systemd/default.nix index f7fefd8110f7..475cf78c4981 100644 --- a/pkgs/os-specific/linux/systemd/default.nix +++ b/pkgs/os-specific/linux/systemd/default.nix @@ -245,18 +245,18 @@ stdenv.mkDerivation (finalAttrs: { ]; postPatch = '' - substituteInPlace src/basic/path-util.h --replace "@defaultPathNormal@" "${placeholder "out"}/bin/" + substituteInPlace src/basic/path-util.h --replace-fail "@defaultPathNormal@" "${placeholder "out"}/bin/" '' + lib.optionalString withLibBPF '' substituteInPlace src/bpf/meson.build \ - --replace "find_program('clang'" "find_program('${stdenv.cc.targetPrefix}clang'" + --replace-fail "find_program('clang'" "find_program('${stdenv.cc.targetPrefix}clang'" '' + lib.optionalString withUkify '' substituteInPlace src/ukify/ukify.py \ - --replace \ + --replace-fail \ "'readelf'" \ "'${targetPackages.stdenv.cc.bintools.targetPrefix}readelf'" \ - --replace \ + --replace-fail \ "/usr/lib/systemd/boot/efi" \ "$out/lib/systemd/boot/efi" '' @@ -580,7 +580,7 @@ stdenv.mkDerivation (finalAttrs: { ]; preConfigure = '' substituteInPlace src/libsystemd/sd-journal/catalog.c \ - --replace /usr/lib/systemd/catalog/ $out/lib/systemd/catalog/ + --replace-fail /usr/lib/systemd/catalog/ $out/lib/systemd/catalog/ ''; # These defines are overridden by CFLAGS and would trigger annoying @@ -628,7 +628,7 @@ stdenv.mkDerivation (finalAttrs: { # Fix reference to /bin/false in the D-Bus services. for i in $out/share/dbus-1/system-services/*.service; do - substituteInPlace $i --replace /bin/false ${coreutils}/bin/false + substituteInPlace $i --replace-fail /bin/false ${coreutils}/bin/false done # For compatibility with dependents that use sbin instead of bin.