util-linux: replace "minimal" opt with more outputs

The "minimal" argument just removed some files to reduce package
size.  Now that we have multiple output derivations in Nixpkgs (we
didn't when "minimal" was added), we can just throw more outputs at
this problem and get the same effect, with the advantage that those
files are actually there, available for download without a rebuild, if
they're ever needed.

I've tested that with this change, there's no difference in the
closure size of util-linuxMinimal.bin.

We have to set SYSCONFSTATICDIR to stop $bin/bin/agetty looking in
$out for issue or issue.d.  SYSCONFSTATICDIR is supposed to be for
configuration that comes with a package, but it's currently only used
for finding an issue, and util-linux doesn't come with any issue
files, so I'm not really sure what the point is...
This commit is contained in:
Alyssa Ross 2021-10-05 16:13:24 +00:00
parent acb63e654e
commit 5a963f1d97
2 changed files with 5 additions and 8 deletions

View file

@ -1,7 +1,6 @@
{ lib, stdenv, fetchurl, pkg-config, zlib, shadow, libcap_ng
, ncurses ? null, pam, systemd ? null
, minimal ? false
, nlsSupport ? !minimal
, nlsSupport ? true
}:
stdenv.mkDerivation rec {
@ -17,7 +16,7 @@ stdenv.mkDerivation rec {
./rtcwake-search-PATH-for-shutdown.patch
];
outputs = [ "bin" "dev" "out" "man" ];
outputs = [ "bin" "dev" "out" "lib" "man" ];
postPatch = ''
patchShebangs tests/run.sh
@ -46,12 +45,14 @@ stdenv.mkDerivation rec {
(lib.withFeature (systemd != null) "systemd")
(lib.withFeatureAs (systemd != null)
"systemdsystemunitdir" "${placeholder "bin"}/lib/systemd/system/")
"SYSCONFSTATICDIR=${placeholder "lib"}/lib"
] ++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform)
"scanf_cv_type_modifier=ms"
;
makeFlags = [
"usrbin_execdir=${placeholder "bin"}/bin"
"usrlib_execdir=${placeholder "lib"}/lib"
"usrsbin_execdir=${placeholder "bin"}/sbin"
];
@ -62,10 +63,6 @@ stdenv.mkDerivation rec {
doCheck = false; # "For development purpose only. Don't execute on production system!"
postInstall = lib.optionalString minimal ''
rm -rf $out/share/{doc,bash-completion}
'';
enableParallelBuilding = true;
meta = with lib; {

View file

@ -22416,7 +22416,7 @@ with pkgs;
util-linuxCurses = util-linux;
util-linuxMinimal = if stdenv.isLinux then appendToName "minimal" (util-linux.override {
minimal = true;
nlsSupport = false;
ncurses = null;
systemd = null;
}) else util-linux;