at 18.03-beta 76 lines 2.4 kB view raw
1{ lib, stdenv, fetchurl, pkgconfig, zlib, fetchpatch, shadow 2, ncurses ? null, perl ? null, pam, systemd, minimal ? false }: 3 4let 5 version = lib.concatStringsSep "." ([ majorVersion ] 6 ++ lib.optional (patchVersion != "") patchVersion); 7 majorVersion = "2.31"; 8 patchVersion = "1"; 9 10in stdenv.mkDerivation rec { 11 name = "util-linux-${version}"; 12 13 src = fetchurl { 14 url = "mirror://kernel/linux/utils/util-linux/v${majorVersion}/${name}.tar.xz"; 15 sha256 = "04fzrnrr3pvqskvjn9f81y0knh0jvvqx4lmbz5pd4lfdm5pv2l8s"; 16 }; 17 18 patches = [ 19 ./rtcwake-search-PATH-for-shutdown.patch 20 ]; 21 22 outputs = [ "bin" "dev" "out" "man" ]; 23 24 postPatch = '' 25 substituteInPlace include/pathnames.h \ 26 --replace "/bin/login" "${shadow}/bin/login" 27 substituteInPlace sys-utils/eject.c \ 28 --replace "/bin/umount" "$out/bin/umount" 29 ''; 30 31 crossAttrs = { 32 # Work around use of `AC_RUN_IFELSE'. 33 preConfigure = "export scanf_cv_type_modifier=ms"; 34 }; 35 36 preConfigure = lib.optionalString (systemd != null) '' 37 configureFlags+=" --with-systemd --with-systemdsystemunitdir=$bin/lib/systemd/system/" 38 ''; 39 40 # !!! It would be better to obtain the path to the mount helpers 41 # (/sbin/mount.*) through an environment variable, but that's 42 # somewhat risky because we have to consider that mount can setuid 43 # root... 44 configureFlags = [ 45 "--enable-write" 46 "--enable-last" 47 "--enable-mesg" 48 "--disable-use-tty-group" 49 "--enable-fs-paths-default=/run/wrappers/bin:/var/run/current-system/sw/bin:/sbin" 50 "--disable-makeinstall-setuid" "--disable-makeinstall-chown" 51 ] 52 ++ lib.optional (ncurses == null) "--without-ncurses"; 53 54 makeFlags = "usrbin_execdir=$(bin)/bin usrsbin_execdir=$(bin)/sbin"; 55 56 nativeBuildInputs = [ pkgconfig ]; 57 buildInputs = 58 [ zlib pam ] 59 ++ lib.filter (p: p != null) [ ncurses systemd perl ]; 60 61 postInstall = '' 62 rm "$bin/bin/su" # su should be supplied by the su package (shadow) 63 '' + lib.optionalString minimal '' 64 rm -rf $out/share/{locale,doc,bash-completion} 65 ''; 66 67 enableParallelBuilding = true; 68 69 meta = with lib; { 70 homepage = https://www.kernel.org/pub/linux/utils/util-linux/; 71 description = "A set of system utilities for Linux"; 72 license = licenses.gpl2; # also contains parts under more permissive licenses 73 platforms = platforms.linux; 74 priority = 6; # lower priority than coreutils ("kill") and shadow ("login" etc.) packages 75 }; 76}