2022-05-28 13:28:44 +00:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
2021-08-18 21:31:15 +00:00
|
|
|
, fetchFromGitHub
|
|
|
|
, makeDesktopItem
|
|
|
|
, python3Packages
|
|
|
|
, netcdf
|
|
|
|
, glew
|
|
|
|
, glm
|
|
|
|
, libpng
|
|
|
|
, libxml2
|
|
|
|
, freetype
|
|
|
|
, msgpack
|
2022-09-23 19:22:04 +00:00
|
|
|
, qt5
|
2021-08-18 21:31:15 +00:00
|
|
|
}:
|
2017-02-22 00:35:09 +00:00
|
|
|
let
|
2017-06-02 14:34:16 +00:00
|
|
|
pname = "pymol";
|
|
|
|
description = "A Python-enhanced molecular graphics tool";
|
|
|
|
|
|
|
|
desktopItem = makeDesktopItem {
|
2019-09-08 23:38:31 +00:00
|
|
|
name = pname;
|
|
|
|
exec = pname;
|
2017-06-02 14:34:16 +00:00
|
|
|
desktopName = "PyMol Molecular Graphics System";
|
2018-03-26 11:01:25 +00:00
|
|
|
genericName = "Molecular Modeler";
|
2017-06-02 14:34:16 +00:00
|
|
|
comment = description;
|
2020-01-24 19:51:08 +00:00
|
|
|
icon = pname;
|
2022-02-22 14:56:15 +00:00
|
|
|
mimeTypes = [
|
|
|
|
"chemical/x-pdb"
|
|
|
|
"chemical/x-mdl-molfile"
|
|
|
|
"chemical/x-mol2"
|
|
|
|
"chemical/seq-aa-fasta"
|
|
|
|
"chemical/seq-na-fasta"
|
|
|
|
"chemical/x-xyz"
|
|
|
|
"chemical/x-mdl-sdf"
|
|
|
|
];
|
|
|
|
categories = [ "Graphics" "Education" "Science" "Chemistry" ];
|
2017-06-02 14:34:16 +00:00
|
|
|
};
|
2017-02-22 00:35:09 +00:00
|
|
|
in
|
2020-01-24 19:42:59 +00:00
|
|
|
python3Packages.buildPythonApplication rec {
|
|
|
|
inherit pname;
|
2024-04-19 14:30:13 +00:00
|
|
|
version = "3.0.0";
|
2024-04-20 01:37:01 +00:00
|
|
|
pyproject = true;
|
|
|
|
|
2020-01-24 19:42:59 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "schrodinger";
|
|
|
|
repo = "pymol-open-source";
|
|
|
|
rev = "v${version}";
|
2024-04-19 14:30:13 +00:00
|
|
|
hash = "sha256-GhTHxacjGN7XklZ6gileBMRZAGq4Pp4JknNL+qGqrVE=";
|
2017-02-22 00:35:09 +00:00
|
|
|
};
|
|
|
|
|
2024-04-20 01:37:01 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace setup.py \
|
2024-08-13 14:19:52 +00:00
|
|
|
--replace-fail "self.install_libbase" '"${placeholder "out"}/${python3Packages.python.sitePackages}"'
|
2024-04-20 01:37:01 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
build-system = [
|
|
|
|
python3Packages.setuptools
|
|
|
|
];
|
|
|
|
|
2022-09-23 19:22:04 +00:00
|
|
|
nativeBuildInputs = [ qt5.wrapQtAppsHook ];
|
|
|
|
buildInputs = [ python3Packages.numpy python3Packages.pyqt5 glew glm libpng libxml2 freetype msgpack netcdf ];
|
2023-02-19 19:23:32 +00:00
|
|
|
env.NIX_CFLAGS_COMPILE = "-I ${libxml2.dev}/include/libxml2";
|
2020-01-24 19:42:59 +00:00
|
|
|
|
2017-06-02 20:55:16 +00:00
|
|
|
postInstall = with python3Packages; ''
|
2017-06-02 14:34:16 +00:00
|
|
|
wrapProgram $out/bin/pymol \
|
2024-08-13 14:19:52 +00:00
|
|
|
--prefix PYTHONPATH : ${lib.makeSearchPathOutput "lib" python3Packages.python.sitePackages [ pyqt5 pyqt5.pyqt5-sip ]}
|
2020-01-24 19:51:08 +00:00
|
|
|
|
|
|
|
mkdir -p "$out/share/icons/"
|
2024-08-13 14:19:52 +00:00
|
|
|
ln -s $out/${python3Packages.python.sitePackages}/pymol/pymol_path/data/pymol/icons/icon2.svg "$out/share/icons/pymol.svg"
|
2024-04-20 01:37:01 +00:00
|
|
|
'' + lib.optionalString stdenv.hostPlatform.isLinux ''
|
2020-01-24 19:51:08 +00:00
|
|
|
cp -r "${desktopItem}/share/applications/" "$out/share/"
|
2017-02-22 00:35:09 +00:00
|
|
|
'';
|
|
|
|
|
2024-04-20 03:11:41 +00:00
|
|
|
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;
|
|
|
|
|
2022-09-23 19:22:04 +00:00
|
|
|
preFixup = ''
|
|
|
|
wrapQtApp "$out/bin/pymol"
|
|
|
|
'';
|
|
|
|
|
2020-01-25 19:58:36 +00:00
|
|
|
meta = with lib; {
|
2021-08-18 21:31:15 +00:00
|
|
|
inherit description;
|
2024-03-19 02:14:51 +00:00
|
|
|
mainProgram = "pymol";
|
2020-04-01 01:11:51 +00:00
|
|
|
homepage = "https://www.pymol.org/";
|
2020-01-25 19:58:36 +00:00
|
|
|
license = licenses.mit;
|
2024-04-20 04:46:58 +00:00
|
|
|
maintainers = with maintainers; [ natsukium samlich ];
|
2017-02-22 00:35:09 +00:00
|
|
|
};
|
|
|
|
}
|