about summary refs log tree commit diff
path: root/pkgs/development/python-modules/nocturne/default.nix
blob: 42424f1dacc9786a35d5f2d13a9e5ebbf6541435 (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
61
{ buildPythonPackage
, cmake
, fetchFromGitHub
, gtest
, hydra-core
, lib
, nlohmann_json
, pybind11
, PyVirtualDisplay
, sfml
, substituteAll
}:

buildPythonPackage rec {
  pname = "nocturne";
  version = "unstable-2022-10-15";
  format = "setuptools";

  src = fetchFromGitHub {
    owner = "facebookresearch";
    repo = pname;
    rev = "ae0a4e361457caf6b7e397675cc86f46161405ed";
    hash = "sha256-pFVbl4m7qX1mJgleNabRboS9klDDsbzUa4PYL5+Jupc=";
  };

  # Simulate the git submodules but with nixpkgs dependencies
  postUnpack = ''
    rm -rf $sourceRoot/third_party/*
    ln -s ${nlohmann_json.src} $sourceRoot/third_party/json
    ln -s ${pybind11.src} $sourceRoot/third_party/pybind11
  '';

  patches = [
    (substituteAll {
      src = ./dependencies.patch;
      gtest_src = gtest.src;
    })
  ];

  nativeBuildInputs = [ cmake ];
  dontUseCmakeConfigure = true;

  buildInputs = [ sfml ];

  # hydra-core and PyVirtualDisplay are not declared as dependences but they are requirements
  propagatedBuildInputs = [ hydra-core PyVirtualDisplay ];

  # Test suite requires hydra-submitit-launcher which is not packaged as of 2022-01-02
  doCheck = false;

  pythonImportsCheck = [
    "nocturne"
  ];

  meta = with lib; {
    description = "A data-driven, fast driving simulator for multi-agent coordination under partial observability";
    homepage = "https://github.com/facebookresearch/nocturne";
    license = licenses.mit;
    maintainers = with maintainers; [ samuela ];
  };
}