about summary refs log tree commit diff
path: root/pkgs/applications/version-management/smartgithg/default.nix
diff options
context:
space:
mode:
authorMeghea Iulian <iulian.meghea@gmail.com>2019-07-27 18:04:23 +0300
committerMeghea Iulian <iulian.meghea@gmail.com>2019-08-03 20:12:11 +0300
commitc089c155df985dfe3212cb1665d092fdeb7c9dc9 (patch)
treee43cce3a73d0e4b025731fb0bc5d799784e4a7bf /pkgs/applications/version-management/smartgithg/default.nix
parentd80de1b135cf098d8acd134385400fe3956a59e5 (diff)
smartgithg: 18.2.4 -> 18.2.9
Refactored packages:
  * adds makeDesktopItem and remove install_freedesktop_items
  * replaced buildCommand with preFixup & installPhase
  * replaces makeWrapper with wrapGAppsHook
Diffstat (limited to 'pkgs/applications/version-management/smartgithg/default.nix')
-rw-r--r--pkgs/applications/version-management/smartgithg/default.nix112
1 files changed, 69 insertions, 43 deletions
diff --git a/pkgs/applications/version-management/smartgithg/default.nix b/pkgs/applications/version-management/smartgithg/default.nix
index 38c3da220c92c..5c9b5a83c1865 100644
--- a/pkgs/applications/version-management/smartgithg/default.nix
+++ b/pkgs/applications/version-management/smartgithg/default.nix
@@ -1,64 +1,90 @@
-{ stdenv, fetchurl, lib, makeWrapper
-, substituteAll
+{ stdenv
+, fetchurl
+, makeDesktopItem
 , jre
-, gtk2, glib
+, gtk3
+, glib
+, gnome3
+, wrapGAppsHook
+, hicolor-icon-theme
 , libXtst
 , which
 }:
 
 stdenv.mkDerivation rec {
-  name = "smartgithg-${version}";
-  version = "18.2.4";
+  pname = "smartgithg";
+  version = "18.2.9";
 
   src = fetchurl {
     url = "https://www.syntevo.com/downloads/smartgit/smartgit-linux-${builtins.replaceStrings [ "." ] [ "_" ] version}.tar.gz";
-    sha256 = "0ch6vcvndn1fpx05ym9yp2ssfw2af6ac0pw8ssvjkc676zc0jr73";
+    sha256 = "0d08awb2s3w1w8n8048abw2x4wnqhfx96sls9kdsnxj0xrszgz67";
   };
 
-  nativeBuildInputs = [ makeWrapper ];
+  nativeBuildInputs = [ wrapGAppsHook ];
 
-  buildInputs = [ jre ];
+  buildInputs = [ jre gnome3.adwaita-icon-theme hicolor-icon-theme gtk3 ];
 
-  buildCommand = let
-    pkg_path = "$out/${name}";
-    bin_path = "$out/bin";
-    install_freedesktop_items = substituteAll {
-      inherit (stdenv) shell;
-      isExecutable = true;
-      src = ./install_freedesktop_items.sh;
-    };
-    runtime_paths = lib.makeBinPath [
-      jre
-      #git mercurial subversion # the paths are requested in configuration
-      which
-    ];
-    runtime_lib_paths = lib.makeLibraryPath [
-      gtk2 glib
-      libXtst
-    ];
-  in ''
-    tar xvzf $src
-    mkdir -pv $out
-    mkdir -pv ${pkg_path}
-    # unpacking should have produced a dir named 'smartgit'
-    cp -a smartgit/* ${pkg_path}
-    # prevent using packaged jre
-    rm -r ${pkg_path}/jre
-    mkdir -pv ${bin_path}
-    jre=${jre.home}
-    makeWrapper ${pkg_path}/bin/smartgit.sh ${bin_path}/smartgit \
-      --prefix PATH : ${runtime_paths} \
-      --prefix LD_LIBRARY_PATH : ${runtime_lib_paths} \
+  preFixup = with stdenv.lib; ''
+    gappsWrapperArgs+=( \
+      --prefix PATH : ${makeBinPath [ jre which ]} \
+      --prefix LD_LIBRARY_PATH : ${makeLibraryPath [
+        gtk3
+        glib
+        libXtst
+      ]} \
       --prefix JRE_HOME : ${jre} \
       --prefix JAVA_HOME : ${jre} \
-      --prefix SMARTGITHG_JAVA_HOME : ${jre}
-    sed -i '/ --login/d' ${pkg_path}/bin/smartgit.sh
-    patchShebangs $out
-    cp ${bin_path}/smartgit ${bin_path}/smartgithg
+      --prefix SMARTGITHG_JAVA_HOME : ${jre} \
+    ) \
+  '';
+
+  installPhase = ''
+    runHook preInstall
+
+    sed -i '/ --login/d' bin/smartgit.sh
+    mkdir -pv $out/{bin,share/applications,share/icons/hicolor/scalable/apps/}
+    cp -av ./{dictionaries,lib} $out/
+    cp -av bin/smartgit.sh $out/bin/smartgit
+    ln -sfv $out/bin/smartgit $out/bin/smartgithg
+
+    cp -av $desktopItem/share/applications/* $out/share/applications/
+    for icon_size in 32 48 64 128 256; do
+        path=$icon_size'x'$icon_size
+        icon=bin/smartgit-$icon_size.png
+        mkdir -p $out/share/icons/hicolor/$path/apps
+        cp $icon $out/share/icons/hicolor/$path/apps/smartgit.png
+    done
 
-    ${install_freedesktop_items} "${pkg_path}/bin" "$out"
+    cp -av bin/smartgit.svg $out/share/icons/hicolor/scalable/apps/
+
+    runHook postInstall
   '';
 
+  desktopItem = with stdenv.lib; makeDesktopItem rec {
+    name = "smartgit";
+    exec = "smartgit";
+    comment = meta.description;
+    icon = "smartgit";
+    desktopName = "SmartGit";
+    categories = concatStringsSep ";" [
+      "Application"
+      "Development"
+      "RevisionControl"
+    ];
+    mimeType = concatStringsSep ";" [
+      "x-scheme-handler/git"
+      "x-scheme-handler/smartgit"
+      "x-scheme-handler/sourcetree"
+    ];
+    startupNotify = "true";
+    extraEntries = ''
+      Keywords=git
+      StartupWMClass=${name}
+      Version=1.0
+      Encoding=UTF-8
+    '';
+  };
+
   meta = with stdenv.lib; {
     description = "GUI for Git, Mercurial, Subversion";
     homepage = http://www.syntevo.com/smartgit/;