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