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