diff options
| author | Arian van Putten <arian.vanputten@gmail.com> | 2020-10-02 14:02:55 +0200 |
|---|---|---|
| committer | Arian van Putten <arian.vanputten@gmail.com> | 2020-10-02 14:02:55 +0200 |
| commit | bb21fd4db6a41e59fe479375bb117101fa8c3b24 (patch) | |
| tree | 2ede1e2103cc203db3055163f722e5aa3bda997b | |
| parent | systemd: set rootprefix to /run/current-system/systemd (diff) | |
| download | nixpkgs-origin/systemd-lib-reintroduce.tar.gz | |
systemd: reintroduce lib outputorigin/systemd-lib-reintroduce
Now that $lib doesn't refer to rootprefixdir anymore, the
cyclic dependnecy should be gone
| -rw-r--r-- | pkgs/os-specific/linux/systemd/default.nix | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/pkgs/os-specific/linux/systemd/default.nix b/pkgs/os-specific/linux/systemd/default.nix index 99980c6a59da..8b7d1dd3c922 100644 --- a/pkgs/os-specific/linux/systemd/default.nix +++ b/pkgs/os-specific/linux/systemd/default.nix @@ -67,7 +67,7 @@ in stdenv.mkDerivation { "find_program('${stdenv.cc.bintools.targetPrefix}objcopy'" ''; - outputs = [ "out" "man" "dev" ]; + outputs = [ "out" "lib" "man" "dev" ]; nativeBuildInputs = [ pkgconfig intltool gperf libxslt gettext docbook_xsl docbook_xml_dtd_42 docbook_xml_dtd_45 @@ -97,6 +97,7 @@ in stdenv.mkDerivation { "-Ddbussystemservicedir=${placeholder "out"}/share/dbus-1/system-services" "-Dpamconfdir=${placeholder "out"}/etc/pam.d" "-Drootprefix=/run/current-system/systemd" + "-Drootlibdir=${placeholder "lib"}/lib" "-Dpkgconfiglibdir=${placeholder "dev"}/lib/pkgconfig" "-Dpkgconfigdatadir=${placeholder "dev"}/share/pkgconfig" "-Dloadkeys-path=${kbd}/bin/loadkeys" @@ -265,10 +266,39 @@ in stdenv.mkDerivation { # "kernel-install" shouldn't be used on NixOS. find $out -name "*kernel-install*" -exec rm {} \; + + # Keep only libudev and libsystemd in the lib output. + mkdir -p $out/lib + mv $lib/lib/security $lib/lib/libnss* $out/lib/ ''; # */ enableParallelBuilding = true; + # On aarch64 we "leak" a reference to $out/lib/systemd/catalog in the lib + # output. The result of that is a dependency cycle between $out and $lib. + # Thus nix (rightfully) marks the build as failed. That reference originates + # from an array of strings (catalog_file_dirs) in systemd + # (src/src/journal/catalog.{c,h}). The only consumer (as of v242) of the + # symbol is the main function of journalctl. Still libsystemd.so contains + # the VALUE but not the symbol. Systemd seems to be properly using function + # & data sections together with the linker flags to garbage collect unused + # sections (-Wl,--gc-sections). For unknown reasons those flags do not + # eliminate the unused string constants, in this case on aarch64-linux. The + # hacky way is to just remove the reference after we finished compiling. + # Since it can not be used (there is no symbol to actually refer to it) there + # should not be any harm. It is a bit odd and I really do not like starting + # these kind of hacks but there doesn't seem to be a straight forward way at + # this point in time. + # The reference will be replaced by the same reference the usual nukeRefs + # tooling uses. The standard tooling can not / should not be uesd since it + # is a bit too excessive and could potentially do us some (more) harm. + postFixup = '' + nukedRef=$(echo $out | sed -e "s,$NIX_STORE/[^-]*-\(.*\),$NIX_STORE/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-\1,") + cat $lib/lib/libsystemd.so | perl -pe "s|$out/lib/systemd/catalog|$nukedRef/lib/systemd/catalog|" > $lib/lib/libsystemd.so.tmp + mv $lib/lib/libsystemd.so.tmp $(readlink -f $lib/lib/libsystemd.so) + ''; + + # The interface version prevents NixOS from switching to an # incompatible systemd at runtime. (Switching across reboots is # fine, of course.) It should be increased whenever systemd changes |
