summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/nocturne/default.nix
blob: 3d6403452b2eb620d36446801a773a7089a1a69a (plain)
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
62
63
64
65
66
67
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  nlohmann_json,
  pybind11,
  replaceVars,
  gtest,
  setuptools,
  cmake,
  sfml_2,
  hydra-core,
  pyvirtualdisplay,
}:

buildPythonPackage {
  pname = "nocturne";
  version = "0-unstable-2024-06-19";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "facebookresearch";
    repo = "nocturne";
    rev = "6d1e0f329f7acbed01c934842b269333540af6d2";
    hash = "sha256-Ufhvc+IZUrn8i6Fmu6o81LPjY1Jo0vzsso+eLbI1F2s=";
  };

  # 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 = [
    (replaceVars ./dependencies.patch {
      gtest_src = gtest.src;
    })
  ];

  build-system = [
    setuptools
  ];

  nativeBuildInputs = [ cmake ];
  dontUseCmakeConfigure = true;

  buildInputs = [ sfml_2 ];

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

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

  pythonImportsCheck = [ "nocturne" ];

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