about summary refs log tree commit diff
path: root/nixpkgs/pkgs/os-specific/linux/pam_mount
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/os-specific/linux/pam_mount')
-rw-r--r--nixpkgs/pkgs/os-specific/linux/pam_mount/default.nix37
-rw-r--r--nixpkgs/pkgs/os-specific/linux/pam_mount/insert_utillinux_path_hooks.patch30
2 files changed, 67 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/os-specific/linux/pam_mount/default.nix b/nixpkgs/pkgs/os-specific/linux/pam_mount/default.nix
new file mode 100644
index 000000000000..29ed9375c2e3
--- /dev/null
+++ b/nixpkgs/pkgs/os-specific/linux/pam_mount/default.nix
@@ -0,0 +1,37 @@
+{ stdenv, fetchurl, autoconf, automake, pkgconfig, libtool, pam, libHX, libxml2, pcre, perl, openssl, cryptsetup, utillinux }:
+
+stdenv.mkDerivation rec {
+  name = "pam_mount-2.16";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/pam-mount/pam_mount/2.16/${name}.tar.xz";
+    sha256 = "1rvi4irb7ylsbhvx1cr6islm2xxw1a4b19q6z4a9864ndkm0f0mf";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ autoconf automake libtool pam libHX utillinux libxml2 pcre perl openssl cryptsetup ];
+
+  patches = [ ./insert_utillinux_path_hooks.patch ];
+
+  preConfigure = ''
+    substituteInPlace src/mtcrypt.c --replace @@NIX_UTILLINUX@@ ${utillinux}/bin
+    sh autogen.sh --prefix=$out
+    '';
+
+  makeFlags = "DESTDIR=$(out)";
+
+  # Probably a hack, but using DESTDIR and PREFIX makes everything work!
+  postInstall = ''
+    mkdir -p $out
+    cp -r $out/$out/* $out
+    rm -r $out/nix
+    '';
+
+  meta = with stdenv.lib; {
+    homepage = http://pam-mount.sourceforge.net/;
+    description = "PAM module to mount volumes for a user session";
+    maintainers = [ maintainers.tstrobel ];
+    license = with licenses; [ gpl2 gpl3 lgpl21 lgpl3 ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/os-specific/linux/pam_mount/insert_utillinux_path_hooks.patch b/nixpkgs/pkgs/os-specific/linux/pam_mount/insert_utillinux_path_hooks.patch
new file mode 100644
index 000000000000..6d9da05da295
--- /dev/null
+++ b/nixpkgs/pkgs/os-specific/linux/pam_mount/insert_utillinux_path_hooks.patch
@@ -0,0 +1,30 @@
+diff -uNr pam_mount-2.15_old/src/mtcrypt.c pam_mount-2.15/src/mtcrypt.c
+--- pam_mount-2.15_old/src/mtcrypt.c	2015-07-04 16:00:12.917943336 +0200
++++ pam_mount-2.15/src/mtcrypt.c	2015-07-04 16:03:45.685302493 +0200
+@@ -534,7 +534,7 @@
+ 
+ 	/* candidate for replacement by some libmount calls, I guess. */
+ 	argk = 0;
+-	mount_args[argk++] = "mount";
++	mount_args[argk++] = "@@NIX_UTILLINUX@@/mount";
+ 	if (opt->fstype != NULL) {
+ 		mount_args[argk++] = "-t";
+ 		mount_args[argk++] = opt->fstype;
+@@ -668,7 +668,7 @@
+ 
+ 	if (!opt->no_update)
+ 		pmt_smtab_remove(mntpt, SMTABF_MOUNTPOINT);
+-	rmt_args[argk++] = "mount";
++	rmt_args[argk++] = "@@NIX_UTILLINUX@@/mount";
+ 	rmt_args[argk++] = "-o";
+ 	rmt_args[argk++] = opt->extra_opts;
+ 	rmt_args[argk++] = mntpt;
+@@ -749,7 +749,7 @@
+ 		pmt_smtab_remove(mountpoint, SMTABF_MOUNTPOINT);
+ 	pmt_cmtab_remove(mountpoint);
+ 
+-	umount_args[argk++] = "umount";
++	umount_args[argk++] = "@@NIX_UTILLINUX@@/umount";
+ 	umount_args[argk++] = "-i";
+ 	umount_args[argk++] = mountpoint;
+ 	umount_args[argk]   = NULL;