1{ buildPythonPackage
2, cmake
3, fetchFromGitHub
4, gtest
5, hydra-core
6, lib
7, nlohmann_json
8, pybind11
9, pyvirtualdisplay
10, sfml
11, substituteAll
12}:
13
14buildPythonPackage rec {
15 pname = "nocturne";
16 version = "unstable-2022-10-15";
17 format = "setuptools";
18
19 src = fetchFromGitHub {
20 owner = "facebookresearch";
21 repo = pname;
22 rev = "ae0a4e361457caf6b7e397675cc86f46161405ed";
23 hash = "sha256-pFVbl4m7qX1mJgleNabRboS9klDDsbzUa4PYL5+Jupc=";
24 };
25
26 # Simulate the git submodules but with nixpkgs dependencies
27 postUnpack = ''
28 rm -rf $sourceRoot/third_party/*
29 ln -s ${nlohmann_json.src} $sourceRoot/third_party/json
30 ln -s ${pybind11.src} $sourceRoot/third_party/pybind11
31 '';
32
33 patches = [
34 (substituteAll {
35 src = ./dependencies.patch;
36 gtest_src = gtest.src;
37 })
38 ];
39
40 nativeBuildInputs = [ cmake ];
41 dontUseCmakeConfigure = true;
42
43 buildInputs = [ sfml ];
44
45 # hydra-core and pyvirtualdisplay are not declared as dependences but they are requirements
46 propagatedBuildInputs = [ hydra-core pyvirtualdisplay ];
47
48 # Test suite requires hydra-submitit-launcher which is not packaged as of 2022-01-02
49 doCheck = false;
50
51 pythonImportsCheck = [
52 "nocturne"
53 ];
54
55 meta = with lib; {
56 description = "A data-driven, fast driving simulator for multi-agent coordination under partial observability";
57 homepage = "https://github.com/facebookresearch/nocturne";
58 license = licenses.mit;
59 maintainers = with maintainers; [ samuela ];
60 };
61}