Unverified Commit 1bb46ec3 authored by natsukium's avatar natsukium
Browse files

pymol: modernize

parent 1541a030
Loading
Loading
Loading
Loading
+13 −6
Original line number Diff line number Diff line
@@ -39,6 +39,8 @@ in
python3Packages.buildPythonApplication rec {
  inherit pname;
  version = "3.0.0";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "schrodinger";
    repo = "pymol-open-source";
@@ -46,22 +48,27 @@ python3Packages.buildPythonApplication rec {
    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/"
  '';