nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 python3,
6 fuse,
7 pkg-config,
8 libpcap,
9 zlib,
10 nixosTests,
11}:
12
13stdenv.mkDerivation rec {
14 pname = "moosefs";
15 version = "4.57.7";
16
17 src = fetchFromGitHub {
18 owner = "moosefs";
19 repo = "moosefs";
20 rev = "v${version}";
21 sha256 = "sha256-zGMFnb+lr5QNwmvt1mwOAD1Wy2u4yAxX42NEaeAYjUA=";
22 };
23
24 nativeBuildInputs = [
25 pkg-config
26 ];
27
28 buildInputs = [
29 fuse
30 libpcap
31 zlib
32 python3
33 ];
34
35 strictDeps = true;
36
37 buildFlags = lib.optionals stdenv.hostPlatform.isDarwin [
38 "CPPFLAGS=-UHAVE_STRUCT_STAT_ST_BIRTHTIME"
39 ];
40
41 # Fix the build on macOS with macFUSE installed
42 postPatch = lib.optionalString stdenv.hostPlatform.isDarwin ''
43 substituteInPlace configure --replace \
44 "/usr/local/lib/pkgconfig" "/nonexistent"
45 '';
46
47 preBuild = lib.optionalString stdenv.hostPlatform.isDarwin ''
48 substituteInPlace config.h --replace \
49 "#define HAVE_STRUCT_STAT_ST_BIRTHTIME 1" \
50 "#undef HAVE_STRUCT_STAT_ST_BIRTHTIME"
51 '';
52
53 postInstall = ''
54 substituteInPlace $out/sbin/mfscgiserv --replace "datapath=\"$out" "datapath=\""
55 '';
56
57 doCheck = true;
58
59 passthru.tests = {
60 inherit (nixosTests) moosefs;
61 };
62
63 meta = {
64 homepage = "https://moosefs.com";
65 description = "Open Source, Petabyte, Fault-Tolerant, Highly Performing, Scalable Network Distributed File System";
66 platforms = lib.platforms.unix;
67 license = lib.licenses.gpl2Only;
68 maintainers = with lib.maintainers; [
69 mfossen
70 markuskowa
71 ];
72 };
73}