From cb521f75a6ef2cddd0dad75db7345a9b9603aedc Mon Sep 17 00:00:00 2001 From: Will Dietz Date: Wed, 3 Jan 2018 16:49:45 -0600 Subject: linux-pam: fix build w/musl --- pkgs/os-specific/linux/pam/default.nix | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/pkgs/os-specific/linux/pam/default.nix b/pkgs/os-specific/linux/pam/default.nix index fc2a7ea61d2..d9fd164bbc0 100644 --- a/pkgs/os-specific/linux/pam/default.nix +++ b/pkgs/os-specific/linux/pam/default.nix @@ -1,4 +1,4 @@ -{ stdenv, buildPackages, fetchurl, flex, cracklib }: +{ stdenv, buildPackages, targetPlatform, fetchurl, fetchpatch, flex, cracklib }: stdenv.mkDerivation rec { name = "linux-pam-${version}"; @@ -9,6 +9,21 @@ stdenv.mkDerivation rec { sha256 = "1fyi04d5nsh8ivd0rn2y0z83ylgc0licz7kifbb6xxi2ylgfs6i4"; }; + patches = stdenv.lib.optionals (targetPlatform.libc == "musl") [ + (fetchpatch { + url = "https://git.alpinelinux.org/cgit/aports/plain/main/linux-pam/fix-compat.patch?id=05a62bda8ec255d7049a2bd4cf0fdc4b32bdb2cc"; + sha256 = "1h5yp5h2mqp1fcwiwwklyfpa69a3i03ya32pivs60fd7g5bqa7sf"; + }) + (fetchpatch { + url = "https://git.alpinelinux.org/cgit/aports/plain/main/linux-pam/libpam-fix-build-with-eglibc-2.16.patch?id=05a62bda8ec255d7049a2bd4cf0fdc4b32bdb2cc"; + sha256 = "1ib6shhvgzinjsc603k2x1lxh9dic6qq449fnk110gc359m23j81"; + }) + (fetchpatch { + url = "https://git.alpinelinux.org/cgit/aports/plain/main/linux-pam/musl-fix-pam_exec.patch?id=05a62bda8ec255d7049a2bd4cf0fdc4b32bdb2cc"; + sha256 = "04dx6s9d8cxl40r7m7dc4si47ds4niaqm7902y1d6wcjvs11vrf0"; + }) + ]; + outputs = [ "out" "doc" "man" /* "modules" */ ]; nativeBuildInputs = [ buildPackages.stdenv.cc flex ]; @@ -46,6 +61,12 @@ stdenv.mkDerivation rec { preConfigure = '' configureFlags="$configureFlags --includedir=$out/include/security" + '' + stdenv.lib.optionalString (targetPlatform.libc == "musl") '' + # 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 ''; meta = { -- cgit 1.4.1