Skip to content

Commit

Permalink
pam: bind Linux-PAM locales from pam-specific folder (upstream patch)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
trofi committed Sep 1, 2023
1 parent 2a01448 commit d0c42df
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions pkgs/os-specific/linux/pam/default.nix
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -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 ]
Expand Down

0 comments on commit d0c42df

Please sign in to comment.