at 16.09-beta 76 lines 2.6 kB view raw
1{ stdenv, fetchurl, pkgconfig, zlib, ncurses ? null, perl ? null, pam, systemd }: 2 3stdenv.mkDerivation rec { 4 name = "util-linux-${version}"; 5 version = stdenv.lib.concatStringsSep "." ([ majorVersion ] 6 ++ stdenv.lib.optional (patchVersion != "") patchVersion); 7 majorVersion = "2.28"; 8 patchVersion = "1"; 9 10 src = fetchurl { 11 url = "mirror://kernel/linux/utils/util-linux/v${majorVersion}/${name}.tar.xz"; 12 sha256 = "03xnaw3c7pavxvvh1vnimcr44hlhhf25whawiyv8dxsflfj4xkiy"; 13 }; 14 15 patches = [ 16 ./rtcwake-search-PATH-for-shutdown.patch 17 ]; 18 19 outputs = [ "bin" "out" "man" ]; # TODO: $bin is kept the first for now 20 # due to lots of ${utillinux}/bin occurences and headers being rather small 21 outputDev = "bin"; 22 23 24 #FIXME: make it also work on non-nixos? 25 postPatch = '' 26 # Substituting store paths would create a circular dependency on systemd 27 substituteInPlace include/pathnames.h \ 28 --replace "/bin/login" "/run/current-system/sw/bin/login" \ 29 --replace "/sbin/shutdown" "/run/current-system/sw/bin/shutdown" 30 ''; 31 32 crossAttrs = { 33 # Work around use of `AC_RUN_IFELSE'. 34 preConfigure = "export scanf_cv_type_modifier=ms"; 35 }; 36 37 # !!! It would be better to obtain the path to the mount helpers 38 # (/sbin/mount.*) through an environment variable, but that's 39 # somewhat risky because we have to consider that mount can setuid 40 # root... 41 configureFlags = '' 42 --enable-write 43 --enable-last 44 --enable-mesg 45 --disable-use-tty-group 46 --enable-fs-paths-default=/var/setuid-wrappers:/var/run/current-system/sw/bin:/sbin 47 ${if ncurses == null then "--without-ncurses" else ""} 48 ${if systemd == null then "" else '' 49 --with-systemd 50 --with-systemdsystemunitdir=$out/lib/systemd/system/ 51 ''} 52 ''; 53 54 makeFlags = "usrbin_execdir=$(bin)/bin usrsbin_execdir=$(bin)/sbin"; 55 56 nativeBuildInputs = [ pkgconfig ]; 57 buildInputs = 58 [ zlib pam ] 59 ++ stdenv.lib.optional (ncurses != null) ncurses 60 ++ stdenv.lib.optional (systemd != null) [ systemd pkgconfig ] 61 ++ stdenv.lib.optional (perl != null) perl; 62 63 postInstall = '' 64 rm "$bin/bin/su" # su should be supplied by the su package (shadow) 65 ''; 66 67 enableParallelBuilding = true; 68 69 meta = with stdenv.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}