Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib, stdenv
2, fetchFromGitHub
3, python3
4, fuse
5, pkg-config
6, libpcap
7, zlib
8}:
9
10stdenv.mkDerivation rec {
11 pname = "moosefs";
12 version = "3.0.117";
13
14 src = fetchFromGitHub {
15 owner = pname;
16 repo = pname;
17 rev = "v${version}";
18 sha256 = "sha256-6zBMAi9ruPPlcnpdgqwl35QZ5u4MyFPUa70yvGTkHpo=";
19 };
20
21 nativeBuildInputs = [
22 pkg-config
23 ];
24
25 buildInputs =
26 [ fuse libpcap zlib python3 ];
27
28 strictDeps = true;
29
30 buildFlags = lib.optionals stdenv.isDarwin [ "CPPFLAGS=-UHAVE_STRUCT_STAT_ST_BIRTHTIME" ];
31
32 # Fix the build on macOS with macFUSE installed
33 postPatch = lib.optionalString stdenv.isDarwin ''
34 substituteInPlace configure --replace \
35 "/usr/local/lib/pkgconfig" "/nonexistent"
36 '';
37
38 preBuild = lib.optionalString stdenv.isDarwin ''
39 substituteInPlace config.h --replace \
40 "#define HAVE_STRUCT_STAT_ST_BIRTHTIME 1" \
41 "#undef HAVE_STRUCT_STAT_ST_BIRTHTIME"
42 '';
43
44 postInstall = ''
45 substituteInPlace $out/sbin/mfscgiserv --replace "datapath=\"$out" "datapath=\""
46 '';
47
48 doCheck = true;
49
50 meta = with lib; {
51 homepage = "https://moosefs.com";
52 description = "Open Source, Petabyte, Fault-Tolerant, Highly Performing, Scalable Network Distributed File System";
53 platforms = platforms.unix;
54 license = licenses.gpl2;
55 maintainers = [ maintainers.mfossen ];
56 };
57}