summary refs log tree commit diff
path: root/pkgs/os-specific/linux/ldm/default.nix
blob: 5e9b2c869efbed1738e25dfbc07608df0fe96d29 (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
{ stdenv, fetchgit, udev, utillinux, mountPath ? "/media/" }:

assert mountPath != "";

let
  version = "0.5";
  git = https://github.com/LemonBoy/ldm.git;
in
stdenv.mkDerivation rec {
  name = "ldm-${version}";

  # There is a stable release, but we'll use the lvm branch, which
  # contains important fixes for LVM setups.
  src = fetchgit {
    url = meta.repositories.git;
    rev = "refs/tags/v${version}";
    sha256 = "0kkby3a0xgh1lmkbzpsi4am2rqjv3ccgdpic99aw1c76y0ca837y";
  };

  buildInputs = [ udev utillinux ];

  postPatch = ''
    substituteInPlace ldm.c \
      --replace "/mnt/" "${mountPath}"
    sed '16i#include <sys/stat.h>' -i ldm.c
  '';

  buildFlags = "ldm";

  installPhase = ''
    mkdir -p $out/bin
    cp -v ldm $out/bin
  '';

  meta = {
    description = "A lightweight device mounter, with libudev as only dependency";
    license = stdenv.lib.licenses.mit;

    platforms = stdenv.lib.platforms.linux;
    maintainers = [ stdenv.lib.maintainers.the-kenny ];
    repositories.git = git;
  };
}