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