at 24.05-pre 72 lines 2.3 kB view raw
1{ lib, stdenv, buildPackages, fetchurl 2, fetchpatch 3, flex, cracklib, db4, gettext, audit, libxcrypt 4, nixosTests 5, autoreconfHook269, pkg-config-unwrapped 6}: 7 8stdenv.mkDerivation rec { 9 pname = "linux-pam"; 10 version = "1.5.2"; 11 12 src = fetchurl { 13 url = "https://github.com/linux-pam/linux-pam/releases/download/v${version}/Linux-PAM-${version}.tar.xz"; 14 sha256 = "sha256-5OxxMakdpEUSV0Jo9JPG2MoQXIcJFpG46bVspoXU+U0="; 15 }; 16 17 patches = [ 18 ./suid-wrapper-path.patch 19 # Pull support for localization on non-default --prefix: 20 # https://github.com/NixOS/nixpkgs/issues/249010 21 # https://github.com/linux-pam/linux-pam/pull/604 22 (fetchpatch { 23 name = "bind-locales.patch"; 24 url = "https://github.com/linux-pam/linux-pam/commit/77bd338125cde583ecdfb9fd69619bcd2baf15c2.patch"; 25 hash = "sha256-tlc9RcLZpEH315NFD4sdN9yOco8qhC6+bszl4OHm+AI="; 26 }) 27 ]; 28 29 outputs = [ "out" "doc" "man" /* "modules" */ ]; 30 31 depsBuildBuild = [ buildPackages.stdenv.cc ]; 32 # autoreconfHook269 is needed for `suid-wrapper-path.patch` and 33 # `bind-locales.patch` above. 34 # pkg-config-unwrapped is needed for `AC_CHECK_LIB` and `AC_SEARCH_LIBS` 35 nativeBuildInputs = [ flex autoreconfHook269 pkg-config-unwrapped ] 36 ++ lib.optional stdenv.buildPlatform.isDarwin gettext; 37 38 buildInputs = [ cracklib db4 libxcrypt ] 39 ++ lib.optional stdenv.buildPlatform.isLinux audit; 40 41 enableParallelBuilding = true; 42 43 preConfigure = lib.optionalString (stdenv.hostPlatform.libc == "musl") '' 44 # export ac_cv_search_crypt=no 45 # (taken from Alpine linux, apparently insecure but also doesn't build O:)) 46 # disable insecure modules 47 # sed -e 's/pam_rhosts//g' -i modules/Makefile.am 48 sed -e 's/pam_rhosts//g' -i modules/Makefile.in 49 ''; 50 51 configureFlags = [ 52 "--includedir=${placeholder "out"}/include/security" 53 "--enable-sconfigdir=/etc/security" 54 ]; 55 56 installFlags = [ 57 "SCONFIGDIR=${placeholder "out"}/etc/security" 58 ]; 59 60 doCheck = false; # fails 61 62 passthru.tests = { 63 inherit (nixosTests) pam-oath-login pam-u2f shadow sssd-ldap; 64 }; 65 66 meta = with lib; { 67 homepage = "http://www.linux-pam.org/"; 68 description = "Pluggable Authentication Modules, a flexible mechanism for authenticating user"; 69 platforms = platforms.linux; 70 license = licenses.bsd3; 71 }; 72}