From 329d1ba69a3b8b16af228bff28066274bc4cf085 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Katona=20L=C3=A1szl=C3=B3?= Date: Mon, 4 Dec 2017 19:53:36 +0100 Subject: [PATCH] jmol: made it runnable --- .../science/chemistry/jmol/default.nix | 27 ++++++++++++------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/pkgs/applications/science/chemistry/jmol/default.nix b/pkgs/applications/science/chemistry/jmol/default.nix index c85e1143d10..4c4278c30fa 100644 --- a/pkgs/applications/science/chemistry/jmol/default.nix +++ b/pkgs/applications/science/chemistry/jmol/default.nix @@ -1,9 +1,20 @@ { stdenv , fetchurl , unzip +, makeDesktopItem , jre }: +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 stdenv.mkDerivation rec { version = "${baseVersion}.${patchVersion}"; baseVersion = "14.29"; @@ -16,19 +27,18 @@ stdenv.mkDerivation rec { sha256 = "1ndq9am75janshrnk26334z1nmyh3k4bp20napvf2zv0lfp8k3bv"; }; - buildInputs = [ - jre - ]; + patchPhase = '' + sed -i -e "4s:.*:command=${jre}/bin/java:" -e "10s:.*:jarpath=$out/share/jmol/Jmol.jar:" -e "11,21d" jmol + ''; installPhase = '' - mkdir -p "$out/share/jmol" - mkdir -p "$out/bin" + mkdir -p "$out/share/jmol" "$out/bin" ${unzip}/bin/unzip jsmol.zip -d "$out/share/" - sed -i -e 's|command=java|command=${jre}/bin/java|' jmol.sh cp *.jar jmol.sh "$out/share/jmol" - ln -s $out/share/jmol/jmol.sh "$out/bin/jmol" + cp -r ${desktopItem}/share/applications $out/share + cp jmol $out/bin ''; enableParallelBuilding = true; @@ -38,7 +48,6 @@ stdenv.mkDerivation rec { homepage = https://sourceforge.net/projects/jmol; license = licenses.lgpl2; platforms = platforms.all; - maintainers = with maintainers; [ timokau ]; + maintainers = with maintainers; [ timokau mounium ]; }; } -