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