summary refs log tree commit diff
path: root/pkgs/development/python-modules/roboschool/default.nix
blob: a86e17e921b688d8e60f3a0d10ddb3ffa3fd6585 (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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
{ lib
, buildPythonPackage
, isPy3k
, python
, fetchFromGitHub
, fetchpatch
, qt5
, boost
, assimp
, gym
, bullet-roboschool
, pkgconfig
, which
}:

buildPythonPackage rec {
  pname = "roboschool";
  version = "1.0.39";

  src = fetchFromGitHub {
    owner = "openai";
    repo = "roboschool";
    rev = version;
    sha256 = "1s7rp5bbiglnrfm33wf7x7kqj0ks3b21bqyz18c5g6vx39rxbrmh";
  };

  # fails to find boost_python for some reason
  disabled = !isPy3k;

  propagatedBuildInputs = [
    gym
  ];

  nativeBuildInputs = [
    pkgconfig
    qt5.qtbase # needs the `moc` tool
    which
  ];

  buildInputs = [
    bullet-roboschool
    assimp
    qt5.qtbase
    boost
  ];

  NIX_CFLAGS_COMPILE="-I ${python}/include/${python.libPrefix}";

  patches = [
    # Remove kwarg that was removed in upstream gym
    # https://github.com/openai/roboschool/pull/180
    (fetchpatch {
      name = "remove-close-kwarg.patch";
      url = "https://github.com/openai/roboschool/pull/180/commits/334f489c8ce7af4887e376139ec676f89da5b16f.patch";
      sha256 = "0bbz8b63m40a9lrwmh7c8d8gj9kpa8a7svdh08qhrddjkykvip6r";
    })
  ];

  preBuild = ''
    # First build the cpp dependencies
    cd roboschool/cpp-household
    make \
      MOC=moc \
      -j$NIX_BUILD_CORES
    cd ../..
  '';

  # Does a QT sanity check, but QT is not expected to work in isolation
  doCheck = false;

  meta = with lib; {
    description = "Open-source software for robot simulation, integrated with OpenAI Gym";
    homepage = https://github.com/openai/roboschool;
    license = licenses.mit;
    maintainers = with maintainers; [ timokau ];
  };
}