2020-11-24 15:29:28 +00:00
|
|
|
{ stdenv, fetchgit, udev, util-linux, mountPath ? "/media/" }:
|
2013-11-10 13:30:01 +00:00
|
|
|
|
|
|
|
assert mountPath != "";
|
|
|
|
|
|
|
|
let
|
2014-08-12 12:52:48 +01:00
|
|
|
version = "0.5";
|
2020-04-01 02:11:51 +01:00
|
|
|
git = "https://github.com/LemonBoy/ldm.git";
|
2013-11-10 13:30:01 +00:00
|
|
|
in
|
2014-03-04 11:44:15 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2019-08-13 22:52:01 +01:00
|
|
|
pname = "ldm";
|
|
|
|
inherit version;
|
2013-11-10 13:30:01 +00:00
|
|
|
|
|
|
|
# There is a stable release, but we'll use the lvm branch, which
|
|
|
|
# contains important fixes for LVM setups.
|
|
|
|
src = fetchgit {
|
2014-03-04 11:44:15 +00:00
|
|
|
url = meta.repositories.git;
|
2014-08-12 12:52:48 +01:00
|
|
|
rev = "refs/tags/v${version}";
|
2016-06-02 12:26:44 +01:00
|
|
|
sha256 = "0lxfypnbamfx6p9ar5k9wra20gvwn665l4pp2j4vsx4yi5q7rw2n";
|
2013-11-10 13:30:01 +00:00
|
|
|
};
|
|
|
|
|
2020-11-24 15:29:28 +00:00
|
|
|
buildInputs = [ udev util-linux ];
|
2013-11-10 13:30:01 +00:00
|
|
|
|
2016-02-22 00:21:26 +00:00
|
|
|
postPatch = ''
|
2013-11-10 13:30:01 +00:00
|
|
|
substituteInPlace ldm.c \
|
|
|
|
--replace "/mnt/" "${mountPath}"
|
2016-03-20 15:46:50 +00:00
|
|
|
sed '16i#include <sys/stat.h>' -i ldm.c
|
2013-11-10 13:30:01 +00:00
|
|
|
'';
|
|
|
|
|
2019-10-27 13:03:25 +00:00
|
|
|
buildFlags = [ "ldm" ];
|
2014-08-12 12:52:48 +01:00
|
|
|
|
2013-11-10 13:30:01 +00:00
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/bin
|
|
|
|
cp -v ldm $out/bin
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
description = "A lightweight device mounter, with libudev as only dependency";
|
2014-06-19 05:19:00 +01:00
|
|
|
license = stdenv.lib.licenses.mit;
|
2013-11-10 13:30:01 +00:00
|
|
|
|
|
|
|
platforms = stdenv.lib.platforms.linux;
|
2014-03-04 11:44:15 +00:00
|
|
|
repositories.git = git;
|
2013-11-10 13:30:01 +00:00
|
|
|
};
|
|
|
|
}
|