11 , gsettings-desktop-schemas
29 url = "https://github.com/sparrowwallet/${pname}/releases/download/${version}/${pname}-${version}-x86_64.tar.gz";
30 sha256 = "sha256-Z4rA3KObPAOuJeI+TzyYaXDyptAxBAWzYJDTplUvw50=";
32 # nativeBuildInputs, downloadToTemp, and postFetch are used to verify the signed upstream package.
33 # The signature is not a self-contained file. Instead the SHA256 of the package is added to a manifest file.
34 # The manifest file is signed by the owner of the public key, Craig Raw.
35 # Thus to verify the signed package, the manifest is verified with the public key,
36 # and then the package is verified against the manifest.
37 # The public key is obtained from https://keybase.io/craigraw/pgp_keys.asc
38 # and is included in this repo to provide reproducibility.
39 nativeBuildInputs = [ gnupg ];
40 downloadToTemp = true;
44 export GNUPGHOME=$PWD/gnupg
45 mkdir -m 700 -p $GNUPGHOME
46 ln -s ${manifest} ./manifest.txt
47 ln -s ${manifestSignature} ./manifest.txt.asc
48 ln -s $downloadedFile ./${pname}-${version}-x86_64.tar.gz
49 gpg --import ${publicKey}
50 gpg --verify manifest.txt.asc manifest.txt
51 sha256sum -c --ignore-missing manifest.txt
53 mv $downloadedFile $out
58 url = "https://github.com/sparrowwallet/${pname}/releases/download/${version}/${pname}-${version}-manifest.txt";
59 sha256 = "sha256-qjkKw3WmbRBf+yqcSIYVWmYz8M3u2JxnBriR0Ec/C7A=";
62 manifestSignature = fetchurl {
63 url = "https://github.com/sparrowwallet/${pname}/releases/download/${version}/${pname}-${version}-manifest.txt.asc";
64 sha256 = "sha256-CRrEzWqFVFQGWsh2+rjSuGHuFmf+y6SetCi2G89jZ/0=";
67 publicKey = ./publickey.asc;
69 launcher = writeScript "sparrow" ''
72 --module-path @out@/lib:@jdkModules@/modules
73 --add-opens=javafx.graphics/com.sun.javafx.css=org.controlsfx.controls
74 --add-opens=javafx.graphics/javafx.scene=org.controlsfx.controls
75 --add-opens=javafx.controls/com.sun.javafx.scene.control.behavior=org.controlsfx.controls
76 --add-opens=javafx.controls/com.sun.javafx.scene.control.inputmap=org.controlsfx.controls
77 --add-opens=javafx.graphics/com.sun.javafx.scene.traversal=org.controlsfx.controls
78 --add-opens=javafx.base/com.sun.javafx.event=org.controlsfx.controls
79 --add-opens=javafx.controls/javafx.scene.control.cell=com.sparrowwallet.sparrow
80 --add-opens=org.controlsfx.controls/impl.org.controlsfx.skin=com.sparrowwallet.sparrow
81 --add-opens=org.controlsfx.controls/impl.org.controlsfx.skin=javafx.fxml
82 --add-opens=javafx.graphics/com.sun.javafx.tk=centerdevice.nsmenufx
83 --add-opens=javafx.graphics/com.sun.javafx.tk.quantum=centerdevice.nsmenufx
84 --add-opens=javafx.graphics/com.sun.glass.ui=centerdevice.nsmenufx
85 --add-opens=javafx.controls/com.sun.javafx.scene.control=centerdevice.nsmenufx
86 --add-opens=javafx.graphics/com.sun.javafx.menu=centerdevice.nsmenufx
87 --add-opens=javafx.graphics/com.sun.glass.ui=com.sparrowwallet.sparrow
88 --add-opens=javafx.graphics/javafx.scene.input=com.sparrowwallet.sparrow
89 --add-opens=javafx.graphics/com.sun.javafx.application=com.sparrowwallet.sparrow
90 --add-opens=java.base/java.net=com.sparrowwallet.sparrow
91 --add-opens=java.base/java.io=com.google.gson
92 --add-opens=java.smartcardio/sun.security.smartcardio=com.sparrowwallet.sparrow
93 --add-reads=com.sparrowwallet.merged.module=java.desktop
94 --add-reads=com.sparrowwallet.merged.module=java.sql
95 --add-reads=com.sparrowwallet.merged.module=com.sparrowwallet.sparrow
96 --add-reads=com.sparrowwallet.merged.module=ch.qos.logback.classic
97 --add-reads=com.sparrowwallet.merged.module=org.slf4j
98 --add-reads=com.sparrowwallet.merged.module=com.fasterxml.jackson.databind
99 --add-reads=com.sparrowwallet.merged.module=com.fasterxml.jackson.annotation
100 --add-reads=com.sparrowwallet.merged.module=com.fasterxml.jackson.core
101 --add-reads=com.sparrowwallet.merged.module=co.nstant.in.cbor
102 --add-reads=kotlin.stdlib=kotlinx.coroutines.core
103 -m com.sparrowwallet.sparrow
106 XDG_DATA_DIRS=${gsettings-desktop-schemas}/share/gsettings-schemas/${gsettings-desktop-schemas.name}:${gtk3}/share/gsettings-schemas/${gtk3.name}:$XDG_DATA_DIRS ${openjdk}/bin/java ''${params[@]} $@
109 torWrapper = writeScript "tor-wrapper" ''
112 exec ${tor}/bin/tor "$@"
115 jdk-modules = stdenvNoCC.mkDerivation {
116 name = "jdk-modules";
117 nativeBuildInputs = [ openjdk ];
121 # Extract the JDK's JIMAGE and generate a list of modules.
124 jimage extract ${openjdk}/lib/openjdk/lib/modules
125 ls | xargs -d " " -- echo > ../manifest.txt
131 cp manifest.txt $out/
136 sparrow-modules = stdenvNoCC.mkDerivation {
137 pname = "sparrow-modules";
139 nativeBuildInputs = [ makeWrapper gzip gnugrep openjdk autoPatchelfHook (lib.getLib stdenv.cc.cc) zlib ];
142 # Extract Sparrow's JIMAGE and generate a list of them.
145 jimage extract ../lib/runtime/lib/modules
148 cat ${jdk-modules}/manifest.txt | xargs -I {} -- rm -fR {}
150 # Delete unneeded native libs.
152 rm -fR com.sparrowwallet.merged.module/com/sun/jna/freebsd-x86-64
153 rm -fR com.sparrowwallet.merged.module/com/sun/jna/freebsd-x86
154 rm -fR com.sparrowwallet.merged.module/com/sun/jna/linux-aarch64
155 rm -fR com.sparrowwallet.merged.module/com/sun/jna/linux-arm
156 rm -fR com.sparrowwallet.merged.module/com/sun/jna/linux-armel
157 rm -fR com.sparrowwallet.merged.module/com/sun/jna/linux-mips64el
158 rm -fR com.sparrowwallet.merged.module/com/sun/jna/linux-ppc
159 rm -fR com.sparrowwallet.merged.module/com/sun/jna/linux-ppc64le
160 rm -fR com.sparrowwallet.merged.module/com/sun/jna/linux-s390x
161 rm -fR com.sparrowwallet.merged.module/com/sun/jna/linux-x86
162 rm -fR com.sparrowwallet.merged.module/com/sun/jna/openbsd-x86-64
163 rm -fR com.sparrowwallet.merged.module/com/sun/jna/openbsd-x86
164 rm -fR com.sparrowwallet.merged.module/com/sun/jna/sunos-sparc
165 rm -fR com.sparrowwallet.merged.module/com/sun/jna/sunos-sparcv9
166 rm -fR com.sparrowwallet.merged.module/com/sun/jna/sunos-x86-64
167 rm -fR com.sparrowwallet.merged.module/com/sun/jna/sunos-x86
168 rm -fR com.github.sarxos.webcam.capture/com/github/sarxos/webcam/ds/buildin/lib/linux_armel
169 rm -fR com.github.sarxos.webcam.capture/com/github/sarxos/webcam/ds/buildin/lib/linux_armhf
170 rm -fR com.github.sarxos.webcam.capture/com/github/sarxos/webcam/ds/buildin/lib/linux_x86
171 rm com.github.sarxos.webcam.capture/com/github/sarxos/webcam/ds/buildin/lib/linux_x64/OpenIMAJGrabber.so
172 rm -fR com.nativelibs4java.bridj/org/bridj/lib/linux_arm32_armel
173 rm -fR com.nativelibs4java.bridj/org/bridj/lib/linux_armel
174 rm -fR com.nativelibs4java.bridj/org/bridj/lib/linux_armhf
175 rm -fR com.nativelibs4java.bridj/org/bridj/lib/linux_x86
176 rm -fR com.nativelibs4java.bridj/org/bridj/lib/sunos_x64
177 rm -fR com.nativelibs4java.bridj/org/bridj/lib/sunos_x86
178 rm -fR com.sparrowwallet.merged.module/linux-aarch64
179 rm -fR com.sparrowwallet.merged.module/linux-arm
180 rm -fR com.sparrowwallet.merged.module/linux-x86
181 rm com.sparrowwallet.sparrow/native/linux/x64/hwi
183 ls | xargs -d " " -- echo > ../manifest.txt
184 find . | grep "\.so$" | xargs -- chmod ugo+x
187 # Replace the embedded Tor binary (which is in a Tar archive)
188 # with one from Nixpkgs.
189 gzip -c ${torWrapper} > tor.gz
190 cp tor.gz modules/kmp.tor.binary.linuxx64/kmptor/linux/x64/tor.gz
195 cp manifest.txt $out/
197 ln -s ${openimajgrabber}/lib/OpenIMAJGrabber.so $out/modules/com.github.sarxos.webcam.capture/com/github/sarxos/webcam/ds/buildin/lib/linux_x64/OpenIMAJGrabber.so
198 ln -s ${hwi}/bin/hwi $out/modules/com.sparrowwallet.sparrow/native/linux/x64/hwi
202 stdenvNoCC.mkDerivation rec {
204 pname = "sparrow-unwrapped";
205 nativeBuildInputs = [ makeWrapper copyDesktopItems ];
209 name = "sparrow-desktop";
210 exec = "sparrow-desktop";
211 icon = "sparrow-desktop";
212 desktopName = "Sparrow Bitcoin Wallet";
213 genericName = "Bitcoin Wallet";
214 categories = [ "Finance" "Network" ];
215 mimeTypes = [ "application/psbt" "application/bitcoin-transaction" "x-scheme-handler/bitcoin" "x-scheme-handler/auth47" "x-scheme-handler/lightning" ];
216 startupWMClass = "Sparrow";
220 sparrow-icons = stdenvNoCC.mkDerivation {
222 pname = "sparrow-icons";
223 nativeBuildInputs = [ imagemagick ];
226 for n in 16 24 32 48 64 96 128 256; do
228 mkdir -p $out/hicolor/$size/apps
229 convert lib/Sparrow.png -resize $size $out/hicolor/$size/apps/sparrow-desktop.png
237 mkdir -p $out/bin $out
238 ln -s ${sparrow-modules}/modules $out/lib
239 install -D -m 777 ${launcher} $out/bin/sparrow-desktop
240 substituteAllInPlace $out/bin/sparrow-desktop
241 substituteInPlace $out/bin/sparrow-desktop --subst-var-by jdkModules ${jdk-modules}
243 mkdir -p $out/share/icons
244 ln -s ${sparrow-icons}/hicolor $out/share/icons
246 mkdir -p $out/etc/udev/rules.d
247 cp ${hwi}/lib/python*/site-packages/hwilib/udev/*.rules $out/etc/udev/rules.d
253 description = "Modern desktop Bitcoin wallet application supporting most hardware wallets and built on common standards such as PSBT, with an emphasis on transparency and usability";
254 homepage = "https://sparrowwallet.com";
255 sourceProvenance = with sourceTypes; [
259 license = licenses.asl20;
260 maintainers = with maintainers; [ emmanuelrosa _1000101 ];
261 platforms = [ "x86_64-linux" ];
262 mainProgram = "sparrow-desktop";