1{ stdenv, fetchgit, udev, utillinux, mountPath ? "/media/" }:
2
3assert mountPath != "";
4
5let
6 version = "0.5";
7 git = https://github.com/LemonBoy/ldm.git;
8in
9stdenv.mkDerivation rec {
10 name = "ldm-${version}";
11
12 # There is a stable release, but we'll use the lvm branch, which
13 # contains important fixes for LVM setups.
14 src = fetchgit {
15 url = meta.repositories.git;
16 rev = "refs/tags/v${version}";
17 sha256 = "0lxfypnbamfx6p9ar5k9wra20gvwn665l4pp2j4vsx4yi5q7rw2n";
18 };
19
20 buildInputs = [ udev utillinux ];
21
22 postPatch = ''
23 substituteInPlace ldm.c \
24 --replace "/mnt/" "${mountPath}"
25 sed '16i#include <sys/stat.h>' -i ldm.c
26 '';
27
28 buildFlags = "ldm";
29
30 installPhase = ''
31 mkdir -p $out/bin
32 cp -v ldm $out/bin
33 '';
34
35 meta = {
36 description = "A lightweight device mounter, with libudev as only dependency";
37 license = stdenv.lib.licenses.mit;
38
39 platforms = stdenv.lib.platforms.linux;
40 maintainers = [ stdenv.lib.maintainers.the-kenny ];
41 repositories.git = git;
42 };
43}