summary refs log tree commit diff
path: root/pkgs/os-specific/linux/pam
diff options
context:
space:
mode:
authorWill Dietz <w@wdtz.org>2018-01-03 16:49:45 -0600
committerWill Dietz <w@wdtz.org>2018-02-13 09:44:36 -0600
commitcb521f75a6ef2cddd0dad75db7345a9b9603aedc (patch)
treedc3e88010c03276e70bb203df60b9508f50361d3 /pkgs/os-specific/linux/pam
parent65c9c38a21c0b944ddcf1cd014663d6ee40b6793 (diff)
downloadnixpkgs-cb521f75a6ef2cddd0dad75db7345a9b9603aedc.tar
nixpkgs-cb521f75a6ef2cddd0dad75db7345a9b9603aedc.tar.gz
nixpkgs-cb521f75a6ef2cddd0dad75db7345a9b9603aedc.tar.bz2
nixpkgs-cb521f75a6ef2cddd0dad75db7345a9b9603aedc.tar.lz
nixpkgs-cb521f75a6ef2cddd0dad75db7345a9b9603aedc.tar.xz
nixpkgs-cb521f75a6ef2cddd0dad75db7345a9b9603aedc.tar.zst
nixpkgs-cb521f75a6ef2cddd0dad75db7345a9b9603aedc.zip
linux-pam: fix build w/musl
Diffstat (limited to 'pkgs/os-specific/linux/pam')
-rw-r--r--pkgs/os-specific/linux/pam/default.nix23
1 files changed, 22 insertions, 1 deletions
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 = {