2023-11-16 04:20:00 +00:00
|
|
|
{ lib, stdenv, buildPackages, fetchurl
|
|
|
|
, fetchpatch
|
|
|
|
, flex, cracklib, db4, gettext, audit, libxcrypt
|
2021-01-05 17:05:55 +00:00
|
|
|
, nixosTests
|
2023-11-16 04:20:00 +00:00
|
|
|
, autoreconfHook269, pkg-config-unwrapped
|
2021-01-05 17:05:55 +00:00
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "linux-pam";
|
2022-02-10 20:34:41 +00:00
|
|
|
version = "1.5.2";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2021-01-05 17:05:55 +00:00
|
|
|
url = "https://github.com/linux-pam/linux-pam/releases/download/v${version}/Linux-PAM-${version}.tar.xz";
|
2022-02-10 20:34:41 +00:00
|
|
|
sha256 = "sha256-5OxxMakdpEUSV0Jo9JPG2MoQXIcJFpG46bVspoXU+U0=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
patches = [
|
|
|
|
./suid-wrapper-path.patch
|
|
|
|
# Pull support for localization on non-default --prefix:
|
|
|
|
# https://github.com/NixOS/nixpkgs/issues/249010
|
|
|
|
# https://github.com/linux-pam/linux-pam/pull/604
|
|
|
|
(fetchpatch {
|
|
|
|
name = "bind-locales.patch";
|
|
|
|
url = "https://github.com/linux-pam/linux-pam/commit/77bd338125cde583ecdfb9fd69619bcd2baf15c2.patch";
|
|
|
|
hash = "sha256-tlc9RcLZpEH315NFD4sdN9yOco8qhC6+bszl4OHm+AI=";
|
|
|
|
})
|
|
|
|
];
|
2022-02-10 20:34:41 +00:00
|
|
|
|
2024-01-02 11:29:13 +00: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;
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
outputs = [ "out" "doc" "man" /* "modules" */ ];
|
|
|
|
|
|
|
|
depsBuildBuild = [ buildPackages.stdenv.cc ];
|
2023-11-16 04:20:00 +00:00
|
|
|
# autoreconfHook269 is needed for `suid-wrapper-path.patch` and
|
|
|
|
# `bind-locales.patch` above.
|
|
|
|
# pkg-config-unwrapped is needed for `AC_CHECK_LIB` and `AC_SEARCH_LIBS`
|
|
|
|
nativeBuildInputs = [ flex autoreconfHook269 pkg-config-unwrapped ]
|
2021-02-05 17:12:51 +00:00
|
|
|
++ lib.optional stdenv.buildPlatform.isDarwin gettext;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-03-27 19:17:25 +00:00
|
|
|
buildInputs = [ cracklib db4 libxcrypt ]
|
|
|
|
++ lib.optional stdenv.buildPlatform.isLinux audit;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
preConfigure = lib.optionalString (stdenv.hostPlatform.libc == "musl") ''
|
2020-04-24 23:36:52 +00: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
|
|
|
|
'';
|
|
|
|
|
|
|
|
configureFlags = [
|
|
|
|
"--includedir=${placeholder "out"}/include/security"
|
|
|
|
"--enable-sconfigdir=/etc/security"
|
|
|
|
];
|
|
|
|
|
|
|
|
installFlags = [
|
|
|
|
"SCONFIGDIR=${placeholder "out"}/etc/security"
|
|
|
|
];
|
|
|
|
|
|
|
|
doCheck = false; # fails
|
|
|
|
|
2021-01-05 17:05:55 +00:00
|
|
|
passthru.tests = {
|
2023-05-24 13:37:59 +00:00
|
|
|
inherit (nixosTests) pam-oath-login pam-u2f shadow sssd-ldap;
|
2021-01-05 17:05:55 +00:00
|
|
|
};
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "http://www.linux-pam.org/";
|
|
|
|
description = "Pluggable Authentication Modules, a flexible mechanism for authenticating user";
|
|
|
|
platforms = platforms.linux;
|
|
|
|
license = licenses.bsd3;
|
|
|
|
};
|
|
|
|
}
|