pam: bind Linux-PAM locales from pam-specific folder (upstream patch)

Without the change `pam` packa looks up locales already registered via
`bindtextdomain()`:

- shadow: /nix/store/ymcln55n92xm25sk2pipqbcp5xghwc3j-shadow-4.13/share/locale/
- glibc: /nix/store/ibp4camsx1mlllwzh32yyqcq2r2xsy1a-glibc-2.37-8/share/locale

Note that there is no `pam` pne in the list.

The change adds extra lookup location:

- linux-pam: /nix/store/k1lvsb3vyw2ijk9naamnay5nwc4mibda-linux-pam-1.5.2/share/locale

Before the change:

    $ LANGUAGE=fi su
    Password:
    su: Authentication failure

After the change:

    $ LANGUAGE=fi ./result-su/bin/su
    Salasana:
    su: Tunnistautumisvirhe
This commit is contained in:
Sergei Trofimovich 2023-08-16 09:15:54 +01:00
parent 2a01448de1
commit d0c42dfaa7

View file

@ -1,5 +1,8 @@
{ lib, stdenv, buildPackages, fetchurl, flex, cracklib, db4, gettext, audit, libxcrypt
{ lib, stdenv, buildPackages, fetchurl
, fetchpatch
, flex, cracklib, db4, gettext, audit, libxcrypt
, nixosTests
, autoreconfHook269, pkg-config-unwrapped
}:
stdenv.mkDerivation rec {
@ -11,12 +14,24 @@ stdenv.mkDerivation rec {
sha256 = "sha256-5OxxMakdpEUSV0Jo9JPG2MoQXIcJFpG46bVspoXU+U0=";
};
patches = [ ./suid-wrapper-path.patch ];
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=";
})
];
outputs = [ "out" "doc" "man" /* "modules" */ ];
depsBuildBuild = [ buildPackages.stdenv.cc ];
nativeBuildInputs = [ flex ]
# autoreconfHook269 is needed for `bind-locales.patch` above
# pkg-config-unwrapped is needed for `AC_CHECK_LIB` and `AC_SEARCH_LIBS`
nativeBuildInputs = [ flex autoreconfHook269 pkg-config-unwrapped ]
++ lib.optional stdenv.buildPlatform.isDarwin gettext;
buildInputs = [ cracklib db4 libxcrypt ]