Skip to content

Commit b68bddf

Browse files
committed
systemd: remove lib output
systemd 246 started baking in some strings into $lib/lib/libsystemd.so which points back to $out. It might be desirable to not have these strings in there, but instead have systemd ask the running manager for the really active paths via IPC, or patch in some more mutable paths (like /run/current-system/…) - but as long as it is as it is, we should probably should just stop producing the `lib` output for now. This does increase the runtime closure for installations not pulling in systemd.out, or linking against multiple libsystemd's, but doesn't increase the runtime closure for NixOS itself, as it needs systemd anyways, and doesn't link against multiple variants of it. We can also remove the aarch64-specific $out/lib/systemd/catalog hack, and revive it at a later time if the `lib` output is reintroduced.
1 parent 7e189c5 commit b68bddf

1 file changed

Lines changed: 1 addition & 30 deletions

File tree

pkgs/os-specific/linux/systemd/default.nix

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ in stdenv.mkDerivation {
7777
"find_program('${stdenv.cc.bintools.targetPrefix}objcopy'"
7878
'';
7979

80-
outputs = [ "out" "lib" "man" "dev" ];
80+
outputs = [ "out" "man" "dev" ];
8181

8282
nativeBuildInputs =
8383
[ pkgconfig intltool gperf libxslt gettext docbook_xsl docbook_xml_dtd_42 docbook_xml_dtd_45
@@ -107,7 +107,6 @@ in stdenv.mkDerivation {
107107
"-Ddbussystemservicedir=${placeholder "out"}/share/dbus-1/system-services"
108108
"-Dpamconfdir=${placeholder "out"}/etc/pam.d"
109109
"-Drootprefix=${placeholder "out"}"
110-
"-Drootlibdir=${placeholder "lib"}/lib"
111110
"-Dpkgconfiglibdir=${placeholder "dev"}/lib/pkgconfig"
112111
"-Dpkgconfigdatadir=${placeholder "dev"}/share/pkgconfig"
113112
"-Dloadkeys-path=${kbd}/bin/loadkeys"
@@ -276,38 +275,10 @@ in stdenv.mkDerivation {
276275
277276
# "kernel-install" shouldn't be used on NixOS.
278277
find $out -name "*kernel-install*" -exec rm {} \;
279-
280-
# Keep only libudev and libsystemd in the lib output.
281-
mkdir -p $out/lib
282-
mv $lib/lib/security $lib/lib/libnss* $out/lib/
283278
''; # */
284279

285280
enableParallelBuilding = true;
286281

287-
# On aarch64 we "leak" a reference to $out/lib/systemd/catalog in the lib
288-
# output. The result of that is a dependency cycle between $out and $lib.
289-
# Thus nix (rightfully) marks the build as failed. That reference originates
290-
# from an array of strings (catalog_file_dirs) in systemd
291-
# (src/src/journal/catalog.{c,h}). The only consumer (as of v242) of the
292-
# symbol is the main function of journalctl. Still libsystemd.so contains
293-
# the VALUE but not the symbol. Systemd seems to be properly using function
294-
# & data sections together with the linker flags to garbage collect unused
295-
# sections (-Wl,--gc-sections). For unknown reasons those flags do not
296-
# eliminate the unused string constants, in this case on aarch64-linux. The
297-
# hacky way is to just remove the reference after we finished compiling.
298-
# Since it can not be used (there is no symbol to actually refer to it) there
299-
# should not be any harm. It is a bit odd and I really do not like starting
300-
# these kind of hacks but there doesn't seem to be a straight forward way at
301-
# this point in time.
302-
# The reference will be replaced by the same reference the usual nukeRefs
303-
# tooling uses. The standard tooling can not / should not be uesd since it
304-
# is a bit too excessive and could potentially do us some (more) harm.
305-
postFixup = ''
306-
nukedRef=$(echo $out | sed -e "s,$NIX_STORE/[^-]*-\(.*\),$NIX_STORE/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-\1,")
307-
cat $lib/lib/libsystemd.so | perl -pe "s|$out/lib/systemd/catalog|$nukedRef/lib/systemd/catalog|" > $lib/lib/libsystemd.so.tmp
308-
mv $lib/lib/libsystemd.so.tmp $(readlink -f $lib/lib/libsystemd.so)
309-
'';
310-
311282
# The interface version prevents NixOS from switching to an
312283
# incompatible systemd at runtime. (Switching across reboots is
313284
# fine, of course.) It should be increased whenever systemd changes

0 commit comments

Comments
 (0)