utillinuxMinimal: Make more minimal

This removes locales, bash completion and crap like that. This cuts
6.5 MiB from the NixOS system closure (which unfortunately contains
two copies of util-linux, because of the need to break a dependency
cycle with systemd).
This commit is contained in:
Eelco Dolstra 2016-09-05 12:13:31 +02:00
parent 2583c70e91
commit 8295089e6a
2 changed files with 10 additions and 7 deletions

View File

@ -1,9 +1,9 @@
{ stdenv, fetchurl, pkgconfig, zlib, ncurses ? null, perl ? null, pam, systemd }: { lib, stdenv, fetchurl, pkgconfig, zlib, ncurses ? null, perl ? null, pam, systemd, minimal ? false }:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
name = "util-linux-${version}"; name = "util-linux-${version}";
version = stdenv.lib.concatStringsSep "." ([ majorVersion ] version = lib.concatStringsSep "." ([ majorVersion ]
++ stdenv.lib.optional (patchVersion != "") patchVersion); ++ lib.optional (patchVersion != "") patchVersion);
majorVersion = "2.28"; majorVersion = "2.28";
patchVersion = "1"; patchVersion = "1";
@ -56,17 +56,19 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [ pkgconfig ]; nativeBuildInputs = [ pkgconfig ];
buildInputs = buildInputs =
[ zlib pam ] [ zlib pam ]
++ stdenv.lib.optional (ncurses != null) ncurses ++ lib.optional (ncurses != null) ncurses
++ stdenv.lib.optional (systemd != null) [ systemd pkgconfig ] ++ lib.optional (systemd != null) [ systemd pkgconfig ]
++ stdenv.lib.optional (perl != null) perl; ++ lib.optional (perl != null) perl;
postInstall = '' postInstall = ''
rm "$bin/bin/su" # su should be supplied by the su package (shadow) rm "$bin/bin/su" # su should be supplied by the su package (shadow)
'' + lib.optionalString minimal ''
rm -rf $out/share/{locale,doc,bash-completion}
''; '';
enableParallelBuilding = true; enableParallelBuilding = true;
meta = with stdenv.lib; { meta = with lib; {
homepage = https://www.kernel.org/pub/linux/utils/util-linux/; homepage = https://www.kernel.org/pub/linux/utils/util-linux/;
description = "A set of system utilities for Linux"; description = "A set of system utilities for Linux";
license = licenses.gpl2; # also contains parts under more permissive licenses license = licenses.gpl2; # also contains parts under more permissive licenses

View File

@ -11809,6 +11809,7 @@ in
utillinuxCurses = utillinux; utillinuxCurses = utillinux;
utillinuxMinimal = appendToName "minimal" (utillinux.override { utillinuxMinimal = appendToName "minimal" (utillinux.override {
minimal = true;
ncurses = null; ncurses = null;
perl = null; perl = null;
systemd = null; systemd = null;