summary refs log tree commit diff
path: root/pkgs/os-specific/linux/pmount/default.nix
blob: 63d0c88c1f8e9e2ba4d1ad2510137cd68a0f2ae0 (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
{ stdenv, fetchurl, intltool, ntfs3g, utillinux
, mediaDir ? "/media/"
, lockDir ? "/var/lock/pmount"
, whiteList ? "/etc/pmount.allow"
}:

# constraint mention in the configure.ac
assert stdenv.lib.hasSuffix "/" mediaDir;

stdenv.mkDerivation rec {
  pname = "pmount";
  version = "0.9.23";

  src = fetchurl {
    url = "mirror://debian/pool/main/p/pmount/pmount_${version}.orig.tar.bz2";
    sha256 = "db38fc290b710e8e9e9d442da2fb627d41e13b3ee80326c15cc2595ba00ea036";
  };

  buildInputs = [ intltool utillinux ];

  configureFlags = [
    "--with-media-dir=${mediaDir}"
    "--with-lock-dir=${lockDir}"
    "--with-whitelist=${whiteList}"
    "--with-mount-prog=${utillinux}/bin/mount"
    "--with-umount-prog=${utillinux}/bin/umount"
    "--with-mount-ntfs3g=${ntfs3g}/sbin/mount.ntfs-3g"
  ];

  postConfigure = ''
    # etc/Mafile.am is hardcoded and it does not respect the --prefix option.
    substituteInPlace ./etc/Makefile --replace DESTDIR prefix
    # Do not change ownership & Do not add the set user ID bit
    substituteInPlace ./src/Makefile --replace '-o root -g root -m 4755 ' '-m 755 '
  '';

  doCheck = false; # fails 1 out of 1 tests with "Error: could not open fstab-type file: No such file or directory"

  meta = {
    homepage = "https://bazaar.launchpad.net/~fourmond/pmount/main/files";
    description = "Mount removable devices as normal user";
    license = stdenv.lib.licenses.gpl2;
    platforms = stdenv.lib.platforms.linux;
  };
}