2024-04-11 23:54:46 +03:00
|
|
|
{ lib, stdenv, buildPackages, fetchurl
|
2023-08-16 11:15:54 +03:00
|
|
|
, flex, cracklib, db4, gettext, audit, libxcrypt
|
2021-01-03 17:50:37 +03:00
|
|
|
, nixosTests
|
2023-08-16 11:15:54 +03:00
|
|
|
, autoreconfHook269, pkg-config-unwrapped
|
2021-01-03 17:50:37 +03:00
|
|
|
}:
|
2005-10-24 20:07:50 +04:00
|
|
|
|
2011-11-05 01:53:47 +04:00
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 15:41:18 +03:00
|
|
|
pname = "linux-pam";
|
2024-04-11 23:54:46 +03:00
|
|
|
version = "1.6.1";
|
2009-02-18 14:40:32 +03:00
|
|
|
|
2005-10-24 20:07:50 +04:00
|
|
|
src = fetchurl {
|
2023-11-14 16:02:03 +03:00
|
|
|
url = "https://github.com/linux-pam/linux-pam/releases/download/v${version}/Linux-PAM-${version}.tar.xz";
|
2024-04-11 23:54:46 +03:00
|
|
|
hash = "sha256-+JI8dAFZBS1xnb/CovgZQtaN00/K9hxwagLJuA/u744=";
|
2005-10-24 20:07:50 +04:00
|
|
|
};
|
2009-02-18 14:40:32 +03:00
|
|
|
|
2023-08-16 11:15:54 +03:00
|
|
|
patches = [
|
|
|
|
./suid-wrapper-path.patch
|
|
|
|
];
|
2022-01-27 12:10:23 +03:00
|
|
|
|
2023-11-25 00:40:57 +03:00
|
|
|
# Case-insensitivity workaround for https://github.com/linux-pam/linux-pam/issues/569
|
|
|
|
postPatch = if stdenv.buildPlatform.isDarwin && stdenv.buildPlatform != stdenv.hostPlatform then ''
|
|
|
|
rm CHANGELOG
|
|
|
|
touch ChangeLog
|
|
|
|
'' else null;
|
|
|
|
|
2015-04-26 23:06:53 +03:00
|
|
|
outputs = [ "out" "doc" "man" /* "modules" */ ];
|
2013-06-11 15:26:46 +04:00
|
|
|
|
2018-02-06 17:55:52 +03:00
|
|
|
depsBuildBuild = [ buildPackages.stdenv.cc ];
|
2024-01-19 23:35:36 +03:00
|
|
|
# autoreconfHook269 is needed for `suid-wrapper-path.patch` above.
|
2023-08-16 11:15:54 +03:00
|
|
|
# pkg-config-unwrapped is needed for `AC_CHECK_LIB` and `AC_SEARCH_LIBS`
|
|
|
|
nativeBuildInputs = [ flex autoreconfHook269 pkg-config-unwrapped ]
|
2021-01-17 17:35:34 +03:00
|
|
|
++ lib.optional stdenv.buildPlatform.isDarwin gettext;
|
2012-09-21 18:20:26 +04:00
|
|
|
|
2023-03-12 19:58:19 +03:00
|
|
|
buildInputs = [ cracklib db4 libxcrypt ]
|
|
|
|
++ lib.optional stdenv.buildPlatform.isLinux audit;
|
2009-02-18 14:40:32 +03:00
|
|
|
|
2013-06-11 15:26:46 +04:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2021-01-15 17:45:37 +03:00
|
|
|
preConfigure = lib.optionalString (stdenv.hostPlatform.libc == "musl") ''
|
2018-01-04 01:49:45 +03:00
|
|
|
# export ac_cv_search_crypt=no
|
|
|
|
# (taken from Alpine linux, apparently insecure but also doesn't build O:))
|
|
|
|
# disable insecure modules
|
|
|
|
# sed -e 's/pam_rhosts//g' -i modules/Makefile.am
|
|
|
|
sed -e 's/pam_rhosts//g' -i modules/Makefile.in
|
2009-02-18 14:40:32 +03:00
|
|
|
'';
|
2010-08-14 03:09:53 +04:00
|
|
|
|
2019-12-31 00:25:16 +03:00
|
|
|
configureFlags = [
|
|
|
|
"--includedir=${placeholder "out"}/include/security"
|
|
|
|
"--enable-sconfigdir=/etc/security"
|
2024-01-15 20:25:18 +03:00
|
|
|
# The module is deprecated. We re-enable it explicitly until NixOS
|
|
|
|
# module stops using it.
|
|
|
|
"--enable-lastlog"
|
2019-12-31 00:25:16 +03:00
|
|
|
];
|
|
|
|
|
|
|
|
installFlags = [
|
|
|
|
"SCONFIGDIR=${placeholder "out"}/etc/security"
|
|
|
|
];
|
|
|
|
|
2018-04-25 06:20:18 +03:00
|
|
|
doCheck = false; # fails
|
|
|
|
|
2021-01-03 17:50:37 +03:00
|
|
|
passthru.tests = {
|
2023-05-09 18:13:45 +03:00
|
|
|
inherit (nixosTests) pam-oath-login pam-u2f shadow sssd-ldap;
|
2021-01-03 17:50:37 +03:00
|
|
|
};
|
|
|
|
|
2021-01-11 10:54:33 +03:00
|
|
|
meta = with lib; {
|
2020-04-01 04:11:51 +03:00
|
|
|
homepage = "http://www.linux-pam.org/";
|
2010-08-14 03:09:53 +04:00
|
|
|
description = "Pluggable Authentication Modules, a flexible mechanism for authenticating user";
|
2018-04-16 15:11:01 +03:00
|
|
|
platforms = platforms.linux;
|
|
|
|
license = licenses.bsd3;
|
2010-08-14 03:09:53 +04:00
|
|
|
};
|
2005-10-24 20:07:50 +04:00
|
|
|
}
|