Due to a systemd bug [1], building systemd-sysupdate does not require that systemd-pull is built as well. However, systemd-sysupdate has a run-time dependency on systemd-pull. Therefore, override the systemd derivation so that systemd-pull is built. Confusingly, this requires enabling systemd-importd. If systemd-pull or systemd-sysupdate is not built, the resulting image will be broken and users will not be able to recover without either a reinstall or reverting to the previous version. Therefore, add a check to ensure that both are in fact built. Use 'cat' rather than just 'stat' to catch broken symlinks and the like. The override can be removed once https://github.com/NixOS/nixpkgs/pull/461277 is merged, which builds systemd-importd by default on musl. The tests will be preserved to catch any regressions. [1]: https://github.com/systemd/systemd/issues/39635 Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com> --- Changes since v2: - Add link to upstream Nixpkgs issue. --- host/rootfs/default.nix | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/host/rootfs/default.nix b/host/rootfs/default.nix index 84b536eda397adfab0fbb0122a5765571d7d678e..26d6dc3f9a63680bf1867c9769f807dc562c81c9 100644 --- a/host/rootfs/default.nix +++ b/host/rootfs/default.nix @@ -43,7 +43,8 @@ let }) # Take kmod from pkgsGui since we use pkgsGui.kmod.lib below anyway. - ] ++ (with pkgsGui; [ cosmic-files crosvm foot fuse3 kmod systemd ]); + ] ++ (with pkgsGui; [ cosmic-files crosvm foot fuse3 kmod ]); + nixosAllHardware = nixos ({ modulesPath, ... }: { imports = [ (modulesPath + "/profiles/all-hardware.nix") ]; @@ -64,7 +65,16 @@ let # https://inbox.vuxu.org/musl/20251017-dlopen-use-rpath-of-caller-dso-v1-1-46c... usrPackages = [ appvm kernel.modules firmware netvm - ] ++ (with pkgsGui; [ dejavu_fonts kmod.lib mesa westonLite ]); + ] ++ (with pkgsGui; [ + dejavu_fonts kmod.lib mesa westonLite + # Work around NixOS/nixpkgs#459020: without "withImportd = true" + # systemd-pull doesn't get built, so systemd-sysupdate doesn't work. + # TODO: remove this when NixOS/nixpkgs#461277 is merged. + (systemd.override { + withImportd = true; + withSysupdate = true; + }) + ]); appvms = { appvm-firefox = callSpectrumPackage ../../vm/app/firefox.nix {}; @@ -85,6 +95,16 @@ let lndir -ignorelinks -silent "$pkg" "$out/usr" done + # If systemd-pull is missing systemd-sysupdate will fail with a + # very confusing error message. If systemd-sysupdate doesn't work, + # users will not be able to receive an update that fixes the problem. + for i in sysupdate pull; do + if ! cat -- "$out/usr/lib/systemd/systemd-$i" > /dev/null; then + echo "link to systemd-$i didn't get installed" >&2 + exit 1 + fi + done + # Weston doesn't support SVG icons. inkscape -w 20 -h 20 \ -o $out/usr/share/icons/hicolor/20x20/apps/com.system76.CosmicFiles.png \ -- 2.52.0