at 17.09-beta 90 lines 2.5 kB view raw
1{ stdenv, fetchpatch, fetchFromGitHub, autoreconfHook, libxslt, libxml2 2, docbook_xml_dtd_412, docbook_xsl, gnome_doc_utils, flex, bison 3, pam ? null, glibcCross ? null 4, buildPlatform, hostPlatform 5}: 6 7let 8 9 glibc = 10 if hostPlatform != buildPlatform 11 then glibcCross 12 else assert stdenv ? glibc; stdenv.glibc; 13 14 dots_in_usernames = fetchpatch { 15 url = http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/sys-apps/shadow/files/shadow-4.1.3-dots-in-usernames.patch; 16 sha256 = "1fj3rg6x3jppm5jvi9y7fhd2djbi4nc5pgwisw00xlh4qapgz692"; 17 }; 18 19in 20 21stdenv.mkDerivation rec { 22 name = "shadow-${version}"; 23 version = "4.5"; 24 25 src = fetchFromGitHub { 26 owner = "shadow-maint"; 27 repo = "shadow"; 28 rev = "${version}"; 29 sha256 = "1aj7s2arnsfqf34ak40is2zmwm666l28pay6rv1ffx46j0wj4hws"; 30 }; 31 32 buildInputs = stdenv.lib.optional (pam != null && stdenv.isLinux) pam; 33 nativeBuildInputs = [autoreconfHook libxslt libxml2 34 docbook_xml_dtd_412 docbook_xsl gnome_doc_utils flex bison 35 ]; 36 37 patches = 38 [ ./keep-path.patch 39 dots_in_usernames 40 ]; 41 42 # The nix daemon often forbids even creating set[ug]id files. 43 postPatch = 44 ''sed 's/^\(s[ug]idperms\) = [0-9]755/\1 = 0755/' -i src/Makefile.am 45 ''; 46 47 outputs = [ "out" "su" "man" ]; 48 49 enableParallelBuilding = true; 50 51 # Assume System V `setpgrp (void)', which is the default on GNU variants 52 # (`AC_FUNC_SETPGRP' is not cross-compilation capable.) 53 preConfigure = '' 54 export ac_cv_func_setpgrp_void=yes 55 export shadow_cv_logdir=/var/log 56 ( 57 head -n -1 "${docbook_xml_dtd_412}/xml/dtd/docbook/catalog.xml" 58 tail -n +3 "${docbook_xsl}/share/xml/docbook-xsl/catalog.xml" 59 ) > xmlcatalog 60 configureFlags="$configureFlags --with-xml-catalog=$PWD/xmlcatalog "; 61 ''; 62 63 configureFlags = " --enable-man "; 64 65 preBuild = assert glibc != null; 66 '' 67 substituteInPlace lib/nscd.c --replace /usr/sbin/nscd ${glibc.bin}/bin/nscd 68 ''; 69 70 postInstall = 71 '' 72 # Don't install groups, since coreutils already provides it. 73 rm $out/bin/groups 74 rm $man/share/man/man1/groups.* 75 76 # Move the su binary into the su package 77 mkdir -p $su/bin 78 mv $out/bin/su $su/bin 79 ''; 80 81 meta = { 82 homepage = http://pkg-shadow.alioth.debian.org/; 83 description = "Suite containing authentication-related tools such as passwd and su"; 84 platforms = stdenv.lib.platforms.linux; 85 }; 86 87 passthru = { 88 shellPath = "/bin/nologin"; 89 }; 90}