1{
2 lib,
3 stdenv,
4 fetchurl,
5 fuse,
6 zlib,
7 withFuse ? true,
8}:
9
10stdenv.mkDerivation {
11 pname = "sqlar";
12 version = "2018-01-07";
13
14 src = fetchurl {
15 url = "https://www.sqlite.org/sqlar/tarball/4824e73896/sqlar-src-4824e73896.tar.gz";
16 sha256 = "09pikkbp93gqypn3da9zi0dzc47jyypkwc9vnmfzhmw7kpyv8nm9";
17 };
18
19 postPatch = ''
20 substituteInPlace Makefile \
21 --replace 'gcc' '${stdenv.cc.targetPrefix}cc'
22 '';
23
24 buildInputs = [ zlib ] ++ lib.optional withFuse fuse;
25
26 buildFlags = [
27 "CFLAGS=-Wno-error"
28 "sqlar"
29 ]
30 ++ lib.optional withFuse "sqlarfs";
31
32 installPhase = ''
33 install -D -t $out/bin sqlar
34 ''
35 + lib.optionalString withFuse ''
36 install -D -t $out/bin sqlarfs
37 '';
38
39 meta = with lib; {
40 homepage = "https://sqlite.org/sqlar";
41 description = "SQLite Archive utilities";
42 license = licenses.bsd2;
43 platforms = platforms.all;
44 maintainers = with maintainers; [ dtzWill ];
45 };
46}