about summary refs log tree commit diff
path: root/pkgs/tools/filesystems/moosefs/default.nix
blob: 4f5524d6734c2bc26ba4ea6a537c842df94b9ff3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
{ lib, stdenv
, fetchFromGitHub
, python3
, fuse
, pkg-config
, libpcap
, zlib
, nixosTests
}:

stdenv.mkDerivation rec {
  pname = "moosefs";
  version = "3.0.118";

  src = fetchFromGitHub {
    owner = pname;
    repo = pname;
    rev = "v${version}";
    sha256 = "sha256-Sm32VwKlE0V5HZj+VXr66gYKS+fcU1+UVQELiZ64DpU=";
  };

  nativeBuildInputs = [
    pkg-config
  ];

  buildInputs =
    [ fuse libpcap zlib python3 ];

  strictDeps = true;

  buildFlags = lib.optionals stdenv.isDarwin [ "CPPFLAGS=-UHAVE_STRUCT_STAT_ST_BIRTHTIME" ];

  # Fix the build on macOS with macFUSE installed
  postPatch = lib.optionalString stdenv.isDarwin ''
    substituteInPlace configure --replace \
      "/usr/local/lib/pkgconfig" "/nonexistent"
  '';

  preBuild = lib.optionalString stdenv.isDarwin ''
    substituteInPlace config.h --replace \
      "#define HAVE_STRUCT_STAT_ST_BIRTHTIME 1" \
      "#undef HAVE_STRUCT_STAT_ST_BIRTHTIME"
  '';

  postInstall = ''
    substituteInPlace $out/sbin/mfscgiserv --replace "datapath=\"$out" "datapath=\""
  '';

  doCheck = true;

  passthru.tests = { inherit (nixosTests) moosefs; };

  meta = with lib; {
    homepage = "https://moosefs.com";
    description = "Open Source, Petabyte, Fault-Tolerant, Highly Performing, Scalable Network Distributed File System";
    platforms = platforms.unix;
    license = licenses.gpl2Only;
    maintainers = [ maintainers.mfossen ];
  };
}