about summary refs log tree commit diff
path: root/pkgs/applications/science/chemistry/pymol/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/applications/science/chemistry/pymol/default.nix')
-rw-r--r--pkgs/applications/science/chemistry/pymol/default.nix62
1 files changed, 52 insertions, 10 deletions
diff --git a/pkgs/applications/science/chemistry/pymol/default.nix b/pkgs/applications/science/chemistry/pymol/default.nix
index 0e4728dd65d6f..1733ba2f236c9 100644
--- a/pkgs/applications/science/chemistry/pymol/default.nix
+++ b/pkgs/applications/science/chemistry/pymol/default.nix
@@ -38,33 +38,75 @@ let
 in
 python3Packages.buildPythonApplication rec {
   inherit pname;
-  version = "2.5.0";
+  version = "3.0.0";
+  pyproject = true;
+
   src = fetchFromGitHub {
     owner = "schrodinger";
     repo = "pymol-open-source";
     rev = "v${version}";
-    sha256 = "sha256-JdsgcVF1w1xFPZxVcyS+GcWg4a1Bd4SvxFOuSdlz9SM=";
+    hash = "sha256-GhTHxacjGN7XklZ6gileBMRZAGq4Pp4JknNL+qGqrVE=";
   };
 
+  postPatch = ''
+    substituteInPlace setup.py \
+      --replace-fail "self.install_libbase" '"${placeholder "out"}/${python3.sitePackages}"'
+  '';
+
+  build-system = [
+    python3Packages.setuptools
+  ];
+
   nativeBuildInputs = [ qt5.wrapQtAppsHook ];
   buildInputs = [ python3Packages.numpy python3Packages.pyqt5 glew glm libpng libxml2 freetype msgpack netcdf ];
   env.NIX_CFLAGS_COMPILE = "-I ${libxml2.dev}/include/libxml2";
-  hardeningDisable = [ "format" ];
-
-  installPhase = ''
-    python setup.py install --home="$out"
-    runHook postInstall
-  '';
 
   postInstall = with python3Packages; ''
     wrapProgram $out/bin/pymol \
       --prefix PYTHONPATH : ${lib.makeSearchPathOutput "lib" python3.sitePackages [ pyqt5 pyqt5.pyqt5-sip ]}
 
     mkdir -p "$out/share/icons/"
-    ln -s ../../lib/python/pymol/pymol_path/data/pymol/icons/icon2.svg "$out/share/icons/pymol.svg"
+    ln -s $out/${python3.sitePackages}/pymol/pymol_path/data/pymol/icons/icon2.svg "$out/share/icons/pymol.svg"
+  '' + lib.optionalString stdenv.hostPlatform.isLinux ''
     cp -r "${desktopItem}/share/applications/" "$out/share/"
   '';
 
+  pythonImportsCheck = [
+    "pymol"
+  ];
+
+  nativeCheckInputs = with python3Packages; [
+    python3Packages.msgpack
+    pillow
+    pytestCheckHook
+  ];
+
+  # some tests hang for some reason
+  doCheck = !(stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64);
+
+  disabledTestPaths = [
+    # require biopython which is broken as of 2024-04-20
+    "tests/api/seqalign.py"
+  ];
+
+  disabledTests = [
+    # the output image does not exactly match
+    "test_commands"
+    # touch the network
+    "testFetch"
+    # requires collada2gltf which is not included in nixpkgs
+    "testglTF"
+    # require mmtf-cpp which does not support darwin
+    "testMMTF"
+    "testSave_symmetry__mmtf"
+  ];
+
+  preCheck = ''
+    cd testing
+  '';
+
+  __darwinAllowLocalNetworking = true;
+
   preFixup = ''
     wrapQtApp "$out/bin/pymol"
   '';
@@ -74,6 +116,6 @@ python3Packages.buildPythonApplication rec {
     mainProgram = "pymol";
     homepage = "https://www.pymol.org/";
     license = licenses.mit;
-    maintainers = with maintainers; [ samlich ];
+    maintainers = with maintainers; [ natsukium samlich ];
   };
 }