rio: 0.0.36 -> 0.0.37
[NixPkgs.git] / pkgs / applications / misc / makehuman / default.nix
blob70cb33643ee6705cbae720a896e52287f1854601
1 { stdenv
2 , lib
3 , fetchpatch
4 , fetchFromGitHub
5 , python3
6 , qtbase
7 , qttools
8 , git-lfs
9 , wrapQtAppsHook
12 let
13   pydeps = with python3.pkgs; [
14     numpy
15     pyqt5
16     pyopengl
17   ];
18   python = python3.withPackages (pkgs: pydeps);
20 stdenv.mkDerivation rec {
21   pname = "makehuman";
22   version = "1.2.0";
24   source = fetchFromGitHub {
25     owner = "makehumancommunity";
26     repo = "makehuman";
27     rev = "v${version}";
28     hash = "sha256-mCv6H0B7b4uxozpNHkKsG+Is2H0QYEJnnzKCHixhBpY=";
29     name = "${pname}-source";
30   };
32   assets = fetchFromGitHub {
33     owner = "makehumancommunity";
34     repo = "makehuman-assets";
35     rev = "v${version}";
36     hash = "sha256-Jd2A0PAHVdFMnDLq4Mu5wsK/E6A4QpKjUyv66ix1Gbo=";
37     name = "${pname}-assets-source";
38   };
40   patches = [
41     # work with numpy>=1.24
42     (fetchpatch {
43       name = "fix-compile_targets.py-when-using-numpy-1.24.0-or-newer";
44       url = "https://patch-diff.githubusercontent.com/raw/makehumancommunity/makehuman/pull/220.patch";
45       hash = "sha256-ip7U83cCBrl+4gM1GZ2QQIER5Qur6HRu3a/TnHqk//g=";
46     })
47     # crash related to collections.Callable -> collections.abc.Callable
48     (fetchpatch {
49       name = "remove-unnecessary-compatibility-test";
50       url = "https://patch-diff.githubusercontent.com/raw/makehumancommunity/makehuman/pull/188.patch";
51       hash = "sha256-HGrk3n7rhV4YgK8mNUdfHwQl8dFT8yuzjxorvwfMmJw=";
52     })
53     # some OpenGL issue causing blank windows on recent Qt
54     (fetchpatch {
55       name = "qt-opengl-update-from-qglwidget-to-qopenglwidget-to-fix-blank";
56       url = "https://patch-diff.githubusercontent.com/raw/makehumancommunity/makehuman/pull/197.patch";
57       hash = "sha256-fEqBwg1Jd36nKWIT9XPr6Buj1N3AmTQg2LBaoX3eTxw=";
58     })
59     # multisampling issue
60     (fetchpatch {
61       name = "switch-default-for-multisampling-and-disable-sample-buffers";
62       url = "https://github.com/makehumancommunity/makehuman/commit/c47b884028a24eb190d097e7523a3059e439cb6f.patch";
63       hash = "sha256-tknQHX9qQYH15gyOLNhxfO3bsFVIv3Z1F7ZXD1IT1h4=";
64     })
65     # PyQt >= 5.12
66     (fetchpatch {
67       name = "fix-scrolling-issue-on-pyqt5>=5.12";
68       url = "https://github.com/makehumancommunity/makehuman/commit/02c4269a2d4c57f68159fe8f437a8b1978b99099.patch";
69       hash = "sha256-yR5tZcELX0N83PW/vS6yB5xKoZcHhVp48invlu7quWM=";
70     })
71   ];
73   srcs = [
74     source
75     assets
76   ];
78   sourceRoot = ".";
80   nativeBuildInputs = [
81     python
82     qtbase
83     git-lfs
84     wrapQtAppsHook
85   ];
87   buildInputs = [
88     python
89     qtbase
90   ];
92   propagatedBuildInputs = with python3.pkgs; [
93     pydeps
94   ];
96   finalSource = "${pname}-final";
98   postUnpack = ''
99     mkdir -p $finalSource
100     cp -r $source/makehuman $finalSource
101     chmod u+w $finalSource --recursive
102     cp -r $assets/base/* $finalSource/makehuman/data
103     chmod u+w $finalSource --recursive
104     sourceRoot=$finalSource
105   '';
107   configurePhase = ''
108     runHook preConfigure
109     pushd ./makehuman
110     bash ./cleannpz.sh
111     bash ./cleanpyc.sh
112     python3 ./compile_targets.py
113     python3 ./compile_models.py
114     python3 ./compile_proxies.py
115     popd
116     runHook postConfigure
117   '';
119   buildPhase = ''
120     runHook preBuild
121     mkdir -p $out/opt $out/bin
122     cp -r * $out/opt
123     python -m compileall -o 0 -o 2 $out/opt
124     ln -s $out/opt/makehuman/makehuman.py $out/bin/makehuman
125     chmod +x $out/bin/makehuman
126     runHook postBuild
127   '';
129   preFixup = ''
130     wrapQtApp $out/bin/makehuman
131   '';
133   meta = {
134     description = "Software to create realistic humans";
135     homepage = "http://www.makehumancommunity.org/";
136     license = with lib.licenses; [ agpl3Plus cc0 ];
137     longDescription = ''
138       MakeHuman is a GUI program for procedurally generating
139       realistic-looking humans.
140     '';
141     mainProgram = "makehuman";
142     maintainers = with lib.maintainers; [ elisesouche ];
143     platforms = lib.platforms.all;
144   };