nixpkgs/pkgs/applications/science/chemistry/jmol/default.nix

54 lines
1.4 KiB
Nix
Raw Normal View History

2018-04-11 12:33:26 +03:00
{ stdenv
2018-07-12 23:31:52 +03:00
, lib
2018-04-11 12:33:26 +03:00
, fetchurl
, unzip
2017-12-04 21:53:36 +03:00
, makeDesktopItem
2018-04-11 12:33:26 +03:00
, jre
}:
2017-12-04 21:53:36 +03:00
let
desktopItem = makeDesktopItem {
name = "jmol";
exec = "jmol";
desktopName = "JMol";
genericName = "Molecular Modeler";
mimeType = "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;";
};
in
2018-04-11 12:33:26 +03:00
stdenv.mkDerivation rec {
version = "14.29.42";
2018-04-11 12:33:26 +03:00
pname = "jmol";
src = let
2018-07-12 23:31:52 +03:00
baseVersion = "${lib.versions.major version}.${lib.versions.minor version}";
in fetchurl {
2018-04-11 12:33:26 +03:00
url = "mirror://sourceforge/jmol/Jmol/Version%20${baseVersion}/Jmol%20${version}/Jmol-${version}-binary.tar.gz";
sha256 = "0fpsicxc6aazmz45q1bgnjfwcdmxmzl9h24hpz2q1gdk9cz5aqnp";
2018-04-11 12:33:26 +03:00
};
2017-12-04 21:53:36 +03:00
patchPhase = ''
sed -i -e "4s:.*:command=${jre}/bin/java:" -e "10s:.*:jarpath=$out/share/jmol/Jmol.jar:" -e "11,21d" jmol
'';
2018-04-11 12:33:26 +03:00
installPhase = ''
2017-12-04 21:53:36 +03:00
mkdir -p "$out/share/jmol" "$out/bin"
2018-04-11 12:33:26 +03:00
${unzip}/bin/unzip jsmol.zip -d "$out/share/"
cp *.jar jmol.sh "$out/share/jmol"
2017-12-04 21:53:36 +03:00
cp -r ${desktopItem}/share/applications $out/share
cp jmol $out/bin
2018-04-11 12:33:26 +03:00
'';
enableParallelBuilding = true;
meta = with stdenv.lib; {
description = "A Java 3D viewer for chemical structures";
homepage = https://sourceforge.net/projects/jmol;
license = licenses.lgpl2;
platforms = platforms.all;
2017-12-04 21:53:36 +03:00
maintainers = with maintainers; [ timokau mounium ];
2018-04-11 12:33:26 +03:00
};
}