From 10f40f3ac601e5eecc2b7d4fd884401328c1e146 Mon Sep 17 00:00:00 2001 From: Brenton Horne Date: Sun, 2 Dec 2018 17:53:40 +1000 Subject: [PATCH] scilab-bin: adding application launchers Moving the desktop configuration files from opt/scilab-$ver/share/applications to share/applications, making the required changes, and moving the icons in opt/scilab-$ver/share/icons to share/icons. Moving locales, appdata and mime out of there opt/scilab-${ver} too. Also removing unneeded scilab-${ver} and scilab-${majorVer} symlinks from bin/. --- .../science/math/scilab-bin/default.nix | 34 +++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/pkgs/applications/science/math/scilab-bin/default.nix b/pkgs/applications/science/math/scilab-bin/default.nix index 4b143ed8243c..c3a74d14bc0a 100644 --- a/pkgs/applications/science/math/scilab-bin/default.nix +++ b/pkgs/applications/science/math/scilab-bin/default.nix @@ -61,10 +61,40 @@ stdenv.mkDerivation rec { installPhase = '' mkdir -p "$out/opt/scilab-${ver}" cp -r . "$out/opt/scilab-${ver}/" + + # Create bin/ dir mkdir "$out/bin" - ln -s "$out/opt/scilab-${ver}/bin/scilab" "$out/bin/scilab-${ver}" + + # Creating executable symlinks ln -s "$out/opt/scilab-${ver}/bin/scilab" "$out/bin/scilab" - ln -s "scilab-${ver}" "$out/bin/scilab-${majorVer}" + ln -s "$out/opt/scilab-${ver}/bin/scilab-cli" "$out/bin/scilab-cli" + ln -s "$out/opt/scilab-${ver}/bin/scilab-adv-cli" "$out/bin/scilab-adv-cli" + + # Creating desktop config dir + mkdir -p "$out/share/applications" + + # Moving desktop config files + mv $out/opt/scilab-${ver}/share/applications/*.desktop $out/share/applications + + # Fixing Exec paths and launching each app with a terminal + sed -i -e "s|Exec=|Exec=$out/opt/scilab-${ver}/bin/|g" \ + -e "s|Terminal=.*$|Terminal=true|g" $out/share/applications/*.desktop + + # Moving icons to the appropriate locations + for path in $out/opt/scilab-${ver}/share/icons/hicolor/*/*/* + do + newpath=$(echo $path | sed 's|/opt/scilab-${ver}||g') + filename=$(echo $path | sed 's|.*/||g') + dir=$(echo $newpath | sed "s|$filename||g") + mkdir -p $dir + mv $path $newpath + done + + # Removing emptied folders + rm -rf $out/opt/scilab-${ver}/share/{applications,icons} + + # Moving other share/ folders + mv $out/opt/scilab-${ver}/share/{appdata,locale,mime} $out/share ''; meta = {