1{ lib, stdenv, fetchFromGitHub, curl, fuse, libxml2, pkg-config }:
2
3let
4 srcs = {
5 boxfs2 = fetchFromGitHub {
6 sha256 = "10af1l3sjnh25shmq5gdnpyqk4vrq7i1zklv4csf1n2nrahln8j8";
7 rev = "d7018b0546d2dae956ae3da3fb95d2f63fa6d3ff";
8 repo = "boxfs2";
9 owner = "drotiro";
10 };
11 libapp = fetchFromGitHub {
12 sha256 = "1p2sbxiranan2n2xsfjkp3c6r2vcs57ds6qvjv4crs1yhxr7cp00";
13 rev = "febebe2bc0fb88d57bdf4eb4a2a54c9eeda3f3d8";
14 repo = "libapp";
15 owner = "drotiro";
16 };
17 libjson = fetchFromGitHub {
18 sha256 = "1vhss3gq44nl61fbnh1l3qzwvz623gwhfgykf1lf1p31rjr7273w";
19 rev = "75a7f50fca2c667bc5f32cdd6dd98f2b673f6657";
20 repo = "libjson";
21 owner = "vincenthz";
22 };
23 };
24in stdenv.mkDerivation {
25 pname = "boxfs";
26 version = "2-20150109";
27
28 src = srcs.boxfs2;
29
30 prePatch = with srcs; ''
31 substituteInPlace Makefile --replace "git pull" "true"
32 cp -a --no-preserve=mode ${libapp} libapp
33 cp -a --no-preserve=mode ${libjson} libjson
34 '';
35 patches = [ ./work-around-API-borkage.patch ];
36
37 buildInputs = [ curl fuse libxml2 ];
38 nativeBuildInputs = [ pkg-config ];
39
40 buildFlags = [
41 "static"
42 "CC=${stdenv.cc.targetPrefix}cc"
43 ] ++ lib.optional stdenv.isDarwin "CFLAGS=-D_BSD_SOURCE";
44
45 installPhase = ''
46 mkdir -p $out/bin
47 install boxfs boxfs-init $out/bin
48 '';
49
50 meta = with lib; {
51 description = "FUSE file system for box.com accounts";
52 longDescription = ''
53 Store files on box.com (an account is required). The first time you run
54 boxfs, you will need to complete the authentication (oauth2) process and
55 grant access to your box.com account. Just follow the instructions on
56 the terminal and in your browser. When you've done using your files,
57 unmount the file system with `fusermount -u mountpoint`.
58 '';
59 homepage = "https://github.com/drotiro/boxfs2";
60 license = licenses.gpl3;
61 platforms = platforms.unix;
62 };
63}