Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib, stdenv, fetchurl, pkg-config, zlib, shadow 2, capabilitiesSupport ? stdenv.isLinux 3, libcap_ng 4, libxcrypt 5, ncursesSupport ? true 6, ncurses 7, pamSupport ? true 8, pam 9, systemdSupport ? lib.meta.availableOn stdenv.hostPlatform systemd 10, systemd 11, nlsSupport ? true 12, translateManpages ? true 13, po4a 14, installShellFiles 15, writeSupport ? stdenv.isLinux 16, shadowSupport ? stdenv.isLinux 17, memstreamHook 18}: 19 20stdenv.mkDerivation rec { 21 pname = "util-linux" + lib.optionalString (!nlsSupport && !ncursesSupport && !systemdSupport) "-minimal"; 22 version = "2.39"; 23 24 src = fetchurl { 25 url = "mirror://kernel/linux/utils/util-linux/v${lib.versions.majorMinor version}/util-linux-${version}.tar.xz"; 26 hash = "sha256-MrMKM2zakDGC7WH+s+m5CLdipeZv4U5D77iNNxYgdcs="; 27 }; 28 29 patches = [ 30 ./rtcwake-search-PATH-for-shutdown.patch 31 ]; 32 33 outputs = [ "bin" "dev" "out" "lib" "man" ]; 34 separateDebugInfo = true; 35 36 postPatch = '' 37 patchShebangs tests/run.sh 38 39 substituteInPlace sys-utils/eject.c \ 40 --replace "/bin/umount" "$bin/bin/umount" 41 '' + lib.optionalString shadowSupport '' 42 substituteInPlace include/pathnames.h \ 43 --replace "/bin/login" "${shadow}/bin/login" 44 ''; 45 46 # !!! It would be better to obtain the path to the mount helpers 47 # (/sbin/mount.*) through an environment variable, but that's 48 # somewhat risky because we have to consider that mount can setuid 49 # root... 50 configureFlags = [ 51 "--localstatedir=/var" 52 "--disable-use-tty-group" 53 "--enable-fs-paths-default=/run/wrappers/bin:/run/current-system/sw/bin:/sbin" 54 "--disable-makeinstall-setuid" "--disable-makeinstall-chown" 55 "--disable-su" # provided by shadow 56 (lib.enableFeature writeSupport "write") 57 (lib.enableFeature nlsSupport "nls") 58 (lib.withFeature ncursesSupport "ncursesw") 59 (lib.withFeature systemdSupport "systemd") 60 (lib.withFeatureAs systemdSupport 61 "systemdsystemunitdir" "${placeholder "bin"}/lib/systemd/system/") 62 (lib.enableFeature translateManpages "poman") 63 "SYSCONFSTATICDIR=${placeholder "lib"}/lib" 64 ] ++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) 65 "scanf_cv_type_modifier=ms" 66 ; 67 68 makeFlags = [ 69 "usrbin_execdir=${placeholder "bin"}/bin" 70 "usrlib_execdir=${placeholder "lib"}/lib" 71 "usrsbin_execdir=${placeholder "bin"}/sbin" 72 ]; 73 74 nativeBuildInputs = [ pkg-config installShellFiles ] 75 ++ lib.optionals translateManpages [ po4a ]; 76 77 buildInputs = [ zlib libxcrypt ] 78 ++ lib.optionals pamSupport [ pam ] 79 ++ lib.optionals capabilitiesSupport [ libcap_ng ] 80 ++ lib.optionals ncursesSupport [ ncurses ] 81 ++ lib.optionals systemdSupport [ systemd ] 82 ++ lib.optionals (stdenv.system == "x86_64-darwin") [ memstreamHook ]; 83 84 doCheck = false; # "For development purpose only. Don't execute on production system!" 85 86 enableParallelBuilding = true; 87 88 postInstall = '' 89 installShellCompletion --bash bash-completion/* 90 ''; 91 92 meta = with lib; { 93 homepage = "https://www.kernel.org/pub/linux/utils/util-linux/"; 94 description = "A set of system utilities for Linux"; 95 changelog = "https://mirrors.edge.kernel.org/pub/linux/utils/util-linux/v${lib.versions.majorMinor version}/v${version}-ReleaseNotes"; 96 # https://git.kernel.org/pub/scm/utils/util-linux/util-linux.git/tree/README.licensing 97 license = with licenses; [ gpl2Only gpl2Plus gpl3Plus lgpl21Plus bsd3 bsdOriginalUC publicDomain ]; 98 platforms = platforms.unix; 99 priority = 6; # lower priority than coreutils ("kill") and shadow ("login" etc.) packages 100 }; 101}