lol
1{ stdenv, fetchFromGitHub, fetchpatch, pkgconfig, fuse, adb }:
2
3stdenv.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 nativeBuildInputs = [ pkgconfig ];
23 buildInputs = [ fuse ];
24
25 postPatch = ''
26 # very ugly way of replacing the adb calls
27 sed -e 's|"adb |"${stdenv.lib.getBin adb}/bin/adb |g' \
28 -i adbfs.cpp
29 '';
30
31 installPhase = ''
32 install -D adbfs $out/bin/adbfs
33 '';
34
35 meta = with stdenv.lib; {
36 description = "Mount Android phones on Linux with adb, no root required";
37 inherit (src.meta) homepage;
38 license = licenses.bsd3;
39 maintainers = with maintainers; [ Profpatsch ];
40 platforms = platforms.linux;
41 };
42}