2021-01-15 15:45:37 +01:00
|
|
|
{ lib, stdenv, fetchgit, udev, util-linux, mountPath ? "/media/" }:
|
2013-11-10 14:30:01 +01:00
|
|
|
|
|
|
|
assert mountPath != "";
|
|
|
|
|
|
|
|
let
|
2014-08-12 13:52:48 +02:00
|
|
|
version = "0.5";
|
2020-04-01 03:11:51 +02:00
|
|
|
git = "https://github.com/LemonBoy/ldm.git";
|
2013-11-10 14:30:01 +01:00
|
|
|
in
|
2014-03-04 12:44:15 +01:00
|
|
|
stdenv.mkDerivation rec {
|
2019-08-13 23:52:01 +02:00
|
|
|
pname = "ldm";
|
|
|
|
inherit version;
|
2013-11-10 14:30:01 +01: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 12:44:15 +01:00
|
|
|
url = meta.repositories.git;
|
2014-08-12 13:52:48 +02:00
|
|
|
rev = "refs/tags/v${version}";
|
2016-06-02 13:26:44 +02:00
|
|
|
sha256 = "0lxfypnbamfx6p9ar5k9wra20gvwn665l4pp2j4vsx4yi5q7rw2n";
|
2013-11-10 14:30:01 +01:00
|
|
|
};
|
|
|
|
|
2020-11-24 16:29:28 +01:00
|
|
|
buildInputs = [ udev util-linux ];
|
2013-11-10 14:30:01 +01:00
|
|
|
|
2016-02-22 01:21:26 +01:00
|
|
|
postPatch = ''
|
2013-11-10 14:30:01 +01:00
|
|
|
substituteInPlace ldm.c \
|
|
|
|
--replace "/mnt/" "${mountPath}"
|
2016-03-20 16:46:50 +01:00
|
|
|
sed '16i#include <sys/stat.h>' -i ldm.c
|
2013-11-10 14:30:01 +01:00
|
|
|
'';
|
|
|
|
|
2019-10-27 14:03:25 +01:00
|
|
|
buildFlags = [ "ldm" ];
|
2014-08-12 13:52:48 +02:00
|
|
|
|
2013-11-10 14:30:01 +01:00
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/bin
|
|
|
|
cp -v ldm $out/bin
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
description = "A lightweight device mounter, with libudev as only dependency";
|
2021-01-15 15:45:37 +01:00
|
|
|
license = lib.licenses.mit;
|
2013-11-10 14:30:01 +01:00
|
|
|
|
2021-01-15 15:45:37 +01:00
|
|
|
platforms = lib.platforms.linux;
|
2014-03-04 12:44:15 +01:00
|
|
|
repositories.git = git;
|
2013-11-10 14:30:01 +01:00
|
|
|
};
|
|
|
|
}
|