From d0c42dfaa7db23fdc1b62b3632ef464c968bb11c Mon Sep 17 00:00:00 2001 From: Sergei Trofimovich Date: Wed, 16 Aug 2023 09:15:54 +0100 Subject: [PATCH] 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 --- pkgs/os-specific/linux/pam/default.nix | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/pkgs/os-specific/linux/pam/default.nix b/pkgs/os-specific/linux/pam/default.nix index b16bebbe3d60..9a0b2161ce47 100644 --- a/pkgs/os-specific/linux/pam/default.nix +++ b/pkgs/os-specific/linux/pam/default.nix @@ -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 ]