anvil-editor: init at 0.4
[NixPkgs.git] / pkgs / applications / science / chemistry / jmol / default.nix
blob80704698c07bc913af7d2f2f9ec758cf833b79e3
1 { stdenv
2 , lib
3 , fetchurl
4 , unzip
5 , makeDesktopItem
6 , jre
7 }:
9 let
10   desktopItem = makeDesktopItem {
11     name = "jmol";
12     exec = "jmol";
13     desktopName = "JMol";
14     genericName = "Molecular Modeler";
15     mimeTypes = [
16       "chemical/x-pdb"
17       "chemical/x-mdl-molfile"
18       "chemical/x-mol2"
19       "chemical/seq-aa-fasta"
20       "chemical/seq-na-fasta"
21       "chemical/x-xyz"
22       "chemical/x-mdl-sdf"
23     ];
24     categories = [ "Graphics" "Education" "Science" "Chemistry" ];
25   };
27 stdenv.mkDerivation rec {
28   version = "16.3.1";
29   pname = "jmol";
31   src = let
32     baseVersion = "${lib.versions.major version}.${lib.versions.minor version}";
33   in fetchurl {
34     url = "mirror://sourceforge/jmol/Jmol/Version%20${baseVersion}/Jmol%20${version}/Jmol-${version}-binary.tar.gz";
35     hash = "sha256-mjID6o+2yhzKd1g3MO4as1dA11nhessjzCDHSUyUQBw=";
36   };
38   patchPhase = ''
39     sed -i -e "4s:.*:command=${jre}/bin/java:" -e "10s:.*:jarpath=$out/share/jmol/Jmol.jar:" -e "11,21d" jmol
40   '';
42   installPhase = ''
43     mkdir -p "$out/share/jmol" "$out/bin"
45     ${unzip}/bin/unzip jsmol.zip -d "$out/share/"
47     cp *.jar jmol.sh "$out/share/jmol"
48     cp -r ${desktopItem}/share/applications $out/share
49     cp jmol $out/bin
50   '';
52   enableParallelBuilding = true;
54   meta = with lib; {
55      description = "Java 3D viewer for chemical structures";
56      mainProgram = "jmol";
57      homepage = "https://sourceforge.net/projects/jmol";
58      sourceProvenance = with sourceTypes; [ binaryBytecode ];
59      license = licenses.lgpl2;
60      platforms = platforms.all;
61      maintainers = with maintainers; [ mounium ] ++ teams.sage.members;
62   };