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