From 25e1b2bbefcac0f0727927d7f7b5d1d4f8da582a Mon Sep 17 00:00:00 2001
From: Emmanuel Rosa <emmanuelrosa@protonmail.com>
Date: Sun, 23 Apr 2023 18:35:32 -0400
Subject: [PATCH 1/3] sparrow: add missing JVM arguments

---
 pkgs/applications/blockchains/sparrow/default.nix | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/pkgs/applications/blockchains/sparrow/default.nix b/pkgs/applications/blockchains/sparrow/default.nix
index eecc313af6ec..b4c2ec720eb9 100644
--- a/pkgs/applications/blockchains/sparrow/default.nix
+++ b/pkgs/applications/blockchains/sparrow/default.nix
@@ -47,9 +47,11 @@ let
       --add-opens javafx.controls/com.sun.javafx.scene.control=centerdevice.nsmenufx
       --add-opens javafx.graphics/com.sun.javafx.menu=centerdevice.nsmenufx
       --add-opens javafx.graphics/com.sun.glass.ui=com.sparrowwallet.sparrow
+      --add-opens=javafx.graphics/javafx.scene.input=com.sparrowwallet.sparrow
       --add-opens javafx.graphics/com.sun.javafx.application=com.sparrowwallet.sparrow
       --add-opens java.base/java.net=com.sparrowwallet.sparrow
       --add-opens java.base/java.io=com.google.gson
+      --add-opens=java.smartcardio/sun.security.smartcardio=com.sparrowwallet.sparrow
       --add-reads com.sparrowwallet.merged.module=java.desktop
       --add-reads com.sparrowwallet.merged.module=java.sql
       --add-reads com.sparrowwallet.merged.module=com.sparrowwallet.sparrow

From 5ae84c13355717013d31371000b1f4983a82e60f Mon Sep 17 00:00:00 2001
From: Emmanuel Rosa <emmanuelrosa@protonmail.com>
Date: Sun, 23 Apr 2023 18:43:15 -0400
Subject: [PATCH 2/3] sparrow: fix .desktop file

---
 pkgs/applications/blockchains/sparrow/default.nix | 15 ++++++++-------
 pkgs/applications/blockchains/sparrow/fhsenv.nix  |  4 ++--
 2 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/pkgs/applications/blockchains/sparrow/default.nix b/pkgs/applications/blockchains/sparrow/default.nix
index b4c2ec720eb9..a16c7e0b9af7 100644
--- a/pkgs/applications/blockchains/sparrow/default.nix
+++ b/pkgs/applications/blockchains/sparrow/default.nix
@@ -167,9 +167,9 @@ stdenv.mkDerivation rec {
 
   desktopItems = [
     (makeDesktopItem {
-      name = "Sparrow";
-      exec = pname;
-      icon = pname;
+      name = "sparrow-desktop";
+      exec = "sparrow-desktop";
+      icon = "sparrow-desktop";
       desktopName = "Sparrow Bitcoin Wallet";
       genericName = "Bitcoin Wallet";
       categories = [ "Finance" "Network" ];
@@ -187,7 +187,7 @@ stdenv.mkDerivation rec {
       for n in 16 24 32 48 64 96 128 256; do
         size=$n"x"$n
         mkdir -p $out/hicolor/$size/apps
-        convert lib/Sparrow.png -resize $size $out/hicolor/$size/apps/sparrow.png
+        convert lib/Sparrow.png -resize $size $out/hicolor/$size/apps/sparrow-desktop.png
         done;
     '';
   };
@@ -197,9 +197,9 @@ stdenv.mkDerivation rec {
 
     mkdir -p $out/bin $out
     ln -s ${sparrow-modules}/modules $out/lib
-    install -D -m 777 ${launcher} $out/bin/sparrow
-    substituteAllInPlace $out/bin/sparrow
-    substituteInPlace $out/bin/sparrow --subst-var-by jdkModules ${jdk-modules}
+    install -D -m 777 ${launcher} $out/bin/sparrow-desktop
+    substituteAllInPlace $out/bin/sparrow-desktop
+    substituteInPlace $out/bin/sparrow-desktop --subst-var-by jdkModules ${jdk-modules}
 
     mkdir -p $out/share/icons
     ln -s ${sparrow-icons}/hicolor $out/share/icons
@@ -222,5 +222,6 @@ stdenv.mkDerivation rec {
     license = licenses.asl20;
     maintainers = with maintainers; [ emmanuelrosa _1000101 ];
     platforms = [ "x86_64-linux" ];
+    mainProgram = "sparrow-desktop";
   };
 }
diff --git a/pkgs/applications/blockchains/sparrow/fhsenv.nix b/pkgs/applications/blockchains/sparrow/fhsenv.nix
index ae14e6e4a591..26bf9da0b85d 100644
--- a/pkgs/applications/blockchains/sparrow/fhsenv.nix
+++ b/pkgs/applications/blockchains/sparrow/fhsenv.nix
@@ -4,9 +4,9 @@
 }:
 
 buildFHSEnv {
-  name = "sparrow";
+  name = "sparrow-desktop";
 
-  runScript = "${sparrow-unwrapped}/bin/sparrow";
+  runScript = "${sparrow-unwrapped}/bin/sparrow-desktop";
 
   targetPkgs = pkgs: with pkgs; [
     sparrow-unwrapped

From a8006f29bac9eede3bb45f0971c4acc8d1361c82 Mon Sep 17 00:00:00 2001
From: Emmanuel Rosa <emmanuelrosa@protonmail.com>
Date: Tue, 27 Jun 2023 11:43:32 -0400
Subject: [PATCH 3/3] sparrow: 1.7.6 -> 1.7.7

---
 pkgs/applications/blockchains/sparrow/default.nix | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pkgs/applications/blockchains/sparrow/default.nix b/pkgs/applications/blockchains/sparrow/default.nix
index a16c7e0b9af7..61217c8b4de2 100644
--- a/pkgs/applications/blockchains/sparrow/default.nix
+++ b/pkgs/applications/blockchains/sparrow/default.nix
@@ -21,11 +21,11 @@
 
 let
   pname = "sparrow";
-  version = "1.7.6";
+  version = "1.7.7";
 
   src = fetchurl {
     url = "https://github.com/sparrowwallet/${pname}/releases/download/${version}/${pname}-${version}-x86_64.tar.gz";
-    sha256 = "01ksl790i8swvj8nvl2r27bbd8kad80shsbw3di39925841dp8z3";
+    sha256 = "07mgh6xjj8i4d2pvwldl2y586y4fw9ir0rzxr97bh379fdcfqfxa";
   };
 
   launcher = writeScript "sparrow" ''