summary refs log tree commit diff
path: root/pkgs/applications/networking/sync
diff options
context:
space:
mode:
authorcwyc <16950437+cwyc@users.noreply.github.com>2021-07-23 01:18:56 -0400
committercwyc <16950437+cwyc@users.noreply.github.com>2021-07-24 22:24:02 -0400
commit7b95bd01c1a960319349e09697db5664c514f69d (patch)
tree6c4c712045910157e5d36c80aff0f65e533c81df /pkgs/applications/networking/sync
parentecaf3da9340231e5493eccc3db87604a3705da42 (diff)
downloadnixpkgs-7b95bd01c1a960319349e09697db5664c514f69d.tar
nixpkgs-7b95bd01c1a960319349e09697db5664c514f69d.tar.gz
nixpkgs-7b95bd01c1a960319349e09697db5664c514f69d.tar.bz2
nixpkgs-7b95bd01c1a960319349e09697db5664c514f69d.tar.lz
nixpkgs-7b95bd01c1a960319349e09697db5664c514f69d.tar.xz
nixpkgs-7b95bd01c1a960319349e09697db5664c514f69d.tar.zst
nixpkgs-7b95bd01c1a960319349e09697db5664c514f69d.zip
unison: add desktop file
Added desktop file for program launchers. Also made use of lib.strings.optionalString to replace instances of `if string else ""`.
Diffstat (limited to 'pkgs/applications/networking/sync')
-rw-r--r--pkgs/applications/networking/sync/unison/default.nix29
1 files changed, 23 insertions, 6 deletions
diff --git a/pkgs/applications/networking/sync/unison/default.nix b/pkgs/applications/networking/sync/unison/default.nix
index 9ab8d441508..8a8fc073355 100644
--- a/pkgs/applications/networking/sync/unison/default.nix
+++ b/pkgs/applications/networking/sync/unison/default.nix
@@ -1,4 +1,4 @@
-{lib, stdenv, fetchFromGitHub, ocamlPackages, fontschumachermisc, xset, makeWrapper, ncurses, gnugrep, fetchpatch
+{lib, stdenv, fetchFromGitHub, ocamlPackages, fontschumachermisc, xset, makeWrapper, ncurses, gnugrep, fetchpatch, copyDesktopItems, makeDesktopItem
 , enableX11 ? true}:
 
 let inherit (ocamlPackages) ocaml lablgtk; in
@@ -14,7 +14,7 @@ stdenv.mkDerivation (rec {
     sha256 = "sha256-42hmdMwOYSWGiDCmhuqtpCWtvtyD2l+kA/bhHD/Qh5Y=";
   };
 
-  nativeBuildInputs = [ makeWrapper ];
+  nativeBuildInputs = [ makeWrapper ] ++ (lib.lists.optional enableX11 copyDesktopItems);
   buildInputs = [ ocaml ncurses ];
 
   patches = [
@@ -27,9 +27,9 @@ stdenv.mkDerivation (rec {
     })
   ];
 
-  preBuild = (if enableX11 then ''
+  preBuild = (lib.strings.optionalString enableX11 ''
     sed -i "s|\(OCAMLOPT=.*\)$|\1 -I $(echo "${lablgtk}"/lib/ocaml/*/site-lib/lablgtk2)|" src/Makefile.OCaml
-  '' else "") + ''
+  '') + ''
   echo -e '\ninstall:\n\tcp $(FSMONITOR)$(EXEC_EXT) $(INSTALLDIR)' >> src/fsmonitor/linux/Makefile
   '';
 
@@ -40,15 +40,32 @@ stdenv.mkDerivation (rec {
 
   preInstall = "mkdir -p $out/bin";
 
-  postInstall = if enableX11 then ''
+  postInstall = lib.strings.optionalString enableX11 ''
     for i in $(cd $out/bin && ls); do
       wrapProgram $out/bin/$i \
         --run "[ -n \"\$DISPLAY\" ] && (${xset}/bin/xset q | ${gnugrep}/bin/grep -q \"${fontschumachermisc}\" || ${xset}/bin/xset +fp \"${fontschumachermisc}/lib/X11/fonts/misc\")"
     done
-  '' else "";
+
+    install -D $src/icons/U.svg $out/share/icons/hicolor/scalable/apps/unison.svg
+  '';
 
   dontStrip = !ocaml.nativeCompilers;
 
+  desktopItems = lib.lists.optional enableX11 (makeDesktopItem {
+    name = pname;
+    desktopName = "Unison";
+    comment = "Bidirectional file synchronizer";
+    genericName = "File synchronization tool";
+    exec = "unison";
+    icon = "unison";
+    categories = "Utility;FileTools;GTK;";
+    extraDesktopEntries={
+      StartupWMClass="Unison";
+      StartupNotify="true";
+      X-MultipleArgs="false";
+    };
+  });
+
   meta = {
     homepage = "https://www.cis.upenn.edu/~bcpierce/unison/";
     description = "Bidirectional file synchronizer";