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