at 18.09-beta 2.5 kB view raw
1{ lib, stdenv, fetchurl, pkgconfig, zlib, shadow 2, ncurses ? null, perl ? null, pam, systemd ? null, minimal ? false }: 3 4let 5 version = lib.concatStringsSep "." ([ majorVersion ] 6 ++ lib.optional (patchVersion != "") patchVersion); 7 majorVersion = "2.32"; 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 = "1ck7d8srw5szpjq7v0gpmjahnjs6wgqzm311ki4gazww6xx71rl6"; 16 }; 17 18 patches = [ 19 ./rtcwake-search-PATH-for-shutdown.patch 20 ]; 21 22 outputs = [ "bin" "dev" "out" "man" ]; 23 24 postPatch = '' 25 patchShebangs tests/run.sh 26 27 substituteInPlace include/pathnames.h \ 28 --replace "/bin/login" "${shadow}/bin/login" 29 substituteInPlace sys-utils/eject.c \ 30 --replace "/bin/umount" "$out/bin/umount" 31 ''; 32 33 # !!! It would be better to obtain the path to the mount helpers 34 # (/sbin/mount.*) through an environment variable, but that's 35 # somewhat risky because we have to consider that mount can setuid 36 # root... 37 configureFlags = [ 38 "--enable-write" 39 "--enable-last" 40 "--enable-mesg" 41 "--disable-use-tty-group" 42 "--enable-fs-paths-default=/run/wrappers/bin:/var/run/current-system/sw/bin:/sbin" 43 "--disable-makeinstall-setuid" "--disable-makeinstall-chown" 44 (lib.withFeature (ncurses != null) "ncursesw") 45 (lib.withFeature (systemd != null) "systemd") 46 (lib.withFeatureAs (systemd != null) 47 "systemdsystemunitdir" "$(bin)/lib/systemd/system/") 48 ] ++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) 49 "scanf_cv_type_modifier=ms" 50 ; 51 52 makeFlags = "usrbin_execdir=$(bin)/bin usrsbin_execdir=$(bin)/sbin"; 53 54 nativeBuildInputs = [ pkgconfig ]; 55 buildInputs = 56 [ zlib pam ] 57 ++ lib.filter (p: p != null) [ ncurses systemd perl ]; 58 59 doCheck = false; # "For development purpose only. Don't execute on production system!" 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}