summary refs log tree commit diff
path: root/pkgs/os-specific/linux/pam_mount/default.nix
blob: 5e4e15c364bdbc4524f8c0f09926e9ee2713df8a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
{ lib, stdenv, fetchurl, autoreconfHook, pkg-config, libtool, pam, libHX, libxml2, pcre, perl, openssl, cryptsetup, util-linux }:

stdenv.mkDerivation rec {
  pname = "pam_mount";
  version = "2.17";

  src = fetchurl {
    url = "mirror://sourceforge/pam-mount/pam_mount/${pname}-${version}.tar.xz";
    sha256 = "1q2n6a2ah6nghdn8i6ad2wj247njwb5nx48cggxknaa6lqxylidy";
  };

  patches = [
    ./insert_utillinux_path_hooks.patch
  ];

  postPatch = ''
    substituteInPlace src/mtcrypt.c \
      --replace @@NIX_UTILLINUX@@ ${util-linux}/bin
  '';

  nativeBuildInputs = [ autoreconfHook libtool pkg-config ];

  buildInputs = [ pam libHX util-linux libxml2 pcre perl openssl cryptsetup ];

  enableParallelBuilding = true;

  configureFlags = [
    "--prefix=${placeholder "out"}"
    "--localstatedir=${placeholder "out"}/var"
    "--sbindir=${placeholder "out"}/bin"
    "--sysconfdir=${placeholder "out"}/etc"
    "--with-slibdir=${placeholder "out"}/lib"
  ];

  postInstall = ''
    rm -r $out/var
  '';

  meta = with lib; {
    description = "PAM module to mount volumes for a user session";
    homepage = "https://pam-mount.sourceforge.net/";
    license = with licenses; [ gpl2 gpl3 lgpl21 lgpl3 ];
    maintainers = with maintainers; [ tstrobel ];
    platforms = platforms.linux;
  };
}