1{ lib
2, fetchFromGitHub
3, stdenv
4, substituteAll
5
6, bison
7, boost
8, cmake
9, double-conversion
10, fmt_8
11, fuse3
12, gflags
13, glog
14, gtest
15, jemalloc
16, libarchive
17, libevent
18, libunwind
19, lz4
20, openssl
21, pkg-config
22, ronn
23, xxHash
24, zstd
25}:
26
27stdenv.mkDerivation rec {
28 pname = "dwarfs";
29 version = "0.6.2";
30
31 src = fetchFromGitHub {
32 owner = "mhx";
33 repo = "dwarfs";
34 rev = "v${version}";
35 fetchSubmodules = true;
36 sha256 = "sha256-fA/3AooDndqYiK215cu/zTqCqeccHnwIX2CfJ9sC+Fc=";
37 };
38
39 patches = with lib.versions; [
40 (substituteAll {
41 src = ./version_info.patch;
42
43 gitRev = "v${version}";
44 gitDesc = "v${version}";
45 gitBranch = "v${version}";
46 gitId = "v${version}"; # displayed as version number
47
48 versionMajor = major version;
49 versionMinor = minor version;
50 versionPatch = patch version;
51 })
52 ];
53
54 cmakeFlags = [
55 "-DPREFER_SYSTEM_ZSTD=ON"
56 "-DPREFER_SYSTEM_XXHASH=ON"
57 "-DPREFER_SYSTEM_GTEST=ON"
58
59 # may be added under an option in the future
60 # "-DWITH_LEGACY_FUSE=ON"
61 "-DWITH_TESTS=ON"
62
63 # temporary hack until folly builds work on aarch64,
64 # see https://github.com/facebook/folly/issues/1880
65 "-DCMAKE_LIBRARY_ARCHITECTURE=${if stdenv.isx86_64 then "x86_64" else "dummy"}"
66 ];
67
68 nativeBuildInputs = [
69 bison
70 cmake
71 pkg-config
72 ronn
73 ];
74
75 buildInputs = [
76 # dwarfs
77 boost
78 fmt_8
79 fuse3
80 jemalloc
81 libarchive
82 lz4
83 xxHash
84 zstd
85
86 # folly
87 double-conversion
88 glog
89 libevent
90 libunwind
91 openssl
92 ];
93
94 doCheck = true;
95 nativeCheckInputs = [ gtest ];
96 # this fails inside of the sandbox due to missing access
97 # to the FUSE device
98 GTEST_FILTER = "-tools.everything";
99
100 meta = with lib; {
101 description = "A fast high compression read-only file system";
102 homepage = "https://github.com/mhx/dwarfs";
103 license = licenses.gpl3Plus;
104 maintainers = with maintainers; [ keksbg ];
105 platforms = platforms.linux;
106 };
107}