@@ -0,0 +1,42 @@
1+{ stdenv, fetchFromGitHub, fetchpatch, pkgconfig, fuse, adb }:
2+
3+stdenv.mkDerivation rec {
4+ name = "adbfs-rootless-${version}";
5+ version = "2016-10-02";
6+
7+ src = fetchFromGitHub {
8+ owner = "spion";
9+ repo = "adbfs-rootless";
10+ rev = "b58963430e40c9246710a16cec58e7ffc88baa48";
11+ sha256 = "1kjibl86k6pf7vciwaaxwv5m4q28zdpd2g7yhp71av32jq6j3wm8";
12+ };
13+
14+ patches = [
15+ (fetchpatch {
16+ # https://github.com/spion/adbfs-rootless/issues/14
17+ url = "https://github.com/kronenpj/adbfs-rootless/commit/35f87ce0a7aeddaaad118daed3022e01453b838d.patch";
18+ sha256 = "1iigla74n3hphnyx9ffli9wqk7v71ylvsxama868czlg7851jqj9";
19+ })
20+ ];
21+
22+ buildInputs = [ fuse pkgconfig ];
23+
24+ postPatch = ''
25+ # very ugly way of replacing the adb calls
26+ sed -e 's|"adb |"${stdenv.lib.getBin adb}/bin/adb |g' \
27+ -i adbfs.cpp
28+ '';
29+
30+ installPhase = ''
31+ install -D adbfs $out/bin/adbfs
32+ '';
33+
34+ meta = with stdenv.lib; {
35+ description = "Mount Android phones on Linux with adb, no root required";
36+ inherit (src.meta) homepage;
37+ license = licenses.bsd3;
38+ maintainers = with maintainers; [ profpatsch ];
39+ };
40+
41+
42+}