waylyrics: 0.3.16 -> 0.3.20 (#364626)
[NixPkgs.git] / pkgs / applications / science / chemistry / pymol / default.nix
blob2a02d4aed2f73fdbc5ffefaab3c0e92b1952057c
2   stdenv,
3   lib,
4   fetchFromGitHub,
5   makeDesktopItem,
6   python3Packages,
7   netcdf,
8   glew,
9   glm,
10   libpng,
11   libxml2,
12   freetype,
13   msgpack,
14   qt5,
16 let
17   pname = "pymol";
18   description = "A Python-enhanced molecular graphics tool";
20   desktopItem = makeDesktopItem {
21     name = pname;
22     exec = pname;
23     desktopName = "PyMol Molecular Graphics System";
24     genericName = "Molecular Modeler";
25     comment = description;
26     icon = pname;
27     mimeTypes = [
28       "chemical/x-pdb"
29       "chemical/x-mdl-molfile"
30       "chemical/x-mol2"
31       "chemical/seq-aa-fasta"
32       "chemical/seq-na-fasta"
33       "chemical/x-xyz"
34       "chemical/x-mdl-sdf"
35     ];
36     categories = [
37       "Graphics"
38       "Education"
39       "Science"
40       "Chemistry"
41     ];
42   };
44 python3Packages.buildPythonApplication rec {
45   inherit pname;
46   version = "3.0.0";
47   pyproject = true;
49   src = fetchFromGitHub {
50     owner = "schrodinger";
51     repo = "pymol-open-source";
52     rev = "v${version}";
53     hash = "sha256-GhTHxacjGN7XklZ6gileBMRZAGq4Pp4JknNL+qGqrVE=";
54   };
56   postPatch = ''
57     substituteInPlace setup.py \
58       --replace-fail "self.install_libbase" '"${placeholder "out"}/${python3Packages.python.sitePackages}"'
59   '';
61   build-system = [
62     python3Packages.setuptools
63   ];
65   nativeBuildInputs = [ qt5.wrapQtAppsHook ];
66   buildInputs = [
67     python3Packages.numpy
68     python3Packages.pyqt5
69     glew
70     glm
71     libpng
72     libxml2
73     freetype
74     msgpack
75     netcdf
76   ];
77   env.NIX_CFLAGS_COMPILE = "-I ${libxml2.dev}/include/libxml2";
79   postInstall =
80     with python3Packages;
81     ''
82       wrapProgram $out/bin/pymol \
83         --prefix PYTHONPATH : ${
84           lib.makeSearchPathOutput "lib" python3Packages.python.sitePackages [
85             pyqt5
86             pyqt5.pyqt5-sip
87           ]
88         }
90       mkdir -p "$out/share/icons/"
91       ln -s $out/${python3Packages.python.sitePackages}/pymol/pymol_path/data/pymol/icons/icon2.svg "$out/share/icons/pymol.svg"
92     ''
93     + lib.optionalString stdenv.hostPlatform.isLinux ''
94       cp -r "${desktopItem}/share/applications/" "$out/share/"
95     '';
97   pythonImportsCheck = [
98     "pymol"
99   ];
101   nativeCheckInputs = with python3Packages; [
102     python3Packages.msgpack
103     pillow
104     pytestCheckHook
105   ];
107   # some tests hang for some reason
108   doCheck = !(stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64);
110   disabledTestPaths = [
111     # require biopython which is broken as of 2024-04-20
112     "tests/api/seqalign.py"
113   ];
115   disabledTests = [
116     # the output image does not exactly match
117     "test_commands"
118     # touch the network
119     "testFetch"
120     # requires collada2gltf which is not included in nixpkgs
121     "testglTF"
122     # require mmtf-cpp which does not support darwin
123     "testMMTF"
124     "testSave_symmetry__mmtf"
125   ];
127   preCheck = ''
128     cd testing
129   '';
131   __darwinAllowLocalNetworking = true;
133   preFixup = ''
134     wrapQtApp "$out/bin/pymol"
135   '';
137   meta = with lib; {
138     inherit description;
139     mainProgram = "pymol";
140     homepage = "https://www.pymol.org/";
141     license = licenses.mit;
142     maintainers = with maintainers; [
143       natsukium
144       samlich
145     ];
146   };