at 18.03-beta 91 lines 2.6 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 hostPlatform.libc == "glibc"; stdenv.cc.libc; 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 + stdenv.lib.optionalString (hostPlatform.libc != "glibc") " --disable-nscd "; 65 66 preBuild = stdenv.lib.optionalString (hostPlatform.libc == "glibc") 67 '' 68 substituteInPlace lib/nscd.c --replace /usr/sbin/nscd ${glibc.bin}/bin/nscd 69 ''; 70 71 postInstall = 72 '' 73 # Don't install groups, since coreutils already provides it. 74 rm $out/bin/groups 75 rm $man/share/man/man1/groups.* 76 77 # Move the su binary into the su package 78 mkdir -p $su/bin 79 mv $out/bin/su $su/bin 80 ''; 81 82 meta = { 83 homepage = http://pkg-shadow.alioth.debian.org/; 84 description = "Suite containing authentication-related tools such as passwd and su"; 85 platforms = stdenv.lib.platforms.linux; 86 }; 87 88 passthru = { 89 shellPath = "/bin/nologin"; 90 }; 91}