12 gsettings-desktop-schemas,
30 url = "https://github.com/sparrowwallet/${pname}/releases/download/${version}/${pname}-${version}-x86_64.tar.gz";
31 sha256 = "sha256-Z4rA3KObPAOuJeI+TzyYaXDyptAxBAWzYJDTplUvw50=";
33 # nativeBuildInputs, downloadToTemp, and postFetch are used to verify the signed upstream package.
34 # The signature is not a self-contained file. Instead the SHA256 of the package is added to a manifest file.
35 # The manifest file is signed by the owner of the public key, Craig Raw.
36 # Thus to verify the signed package, the manifest is verified with the public key,
37 # and then the package is verified against the manifest.
38 # The public key is obtained from https://keybase.io/craigraw/pgp_keys.asc
39 # and is included in this repo to provide reproducibility.
40 nativeBuildInputs = [ gnupg ];
41 downloadToTemp = true;
45 export GNUPGHOME=$PWD/gnupg
46 mkdir -m 700 -p $GNUPGHOME
47 ln -s ${manifest} ./manifest.txt
48 ln -s ${manifestSignature} ./manifest.txt.asc
49 ln -s $downloadedFile ./${pname}-${version}-x86_64.tar.gz
50 gpg --import ${publicKey}
51 gpg --verify manifest.txt.asc manifest.txt
52 sha256sum -c --ignore-missing manifest.txt
54 mv $downloadedFile $out
59 url = "https://github.com/sparrowwallet/${pname}/releases/download/${version}/${pname}-${version}-manifest.txt";
60 sha256 = "sha256-qjkKw3WmbRBf+yqcSIYVWmYz8M3u2JxnBriR0Ec/C7A=";
63 manifestSignature = fetchurl {
64 url = "https://github.com/sparrowwallet/${pname}/releases/download/${version}/${pname}-${version}-manifest.txt.asc";
65 sha256 = "sha256-CRrEzWqFVFQGWsh2+rjSuGHuFmf+y6SetCi2G89jZ/0=";
68 publicKey = ./publickey.asc;
70 launcher = writeScript "sparrow" ''
73 --module-path @out@/lib:@jdkModules@/modules
74 --add-opens=javafx.graphics/com.sun.javafx.css=org.controlsfx.controls
75 --add-opens=javafx.graphics/javafx.scene=org.controlsfx.controls
76 --add-opens=javafx.controls/com.sun.javafx.scene.control.behavior=org.controlsfx.controls
77 --add-opens=javafx.controls/com.sun.javafx.scene.control.inputmap=org.controlsfx.controls
78 --add-opens=javafx.graphics/com.sun.javafx.scene.traversal=org.controlsfx.controls
79 --add-opens=javafx.base/com.sun.javafx.event=org.controlsfx.controls
80 --add-opens=javafx.controls/javafx.scene.control.cell=com.sparrowwallet.sparrow
81 --add-opens=org.controlsfx.controls/impl.org.controlsfx.skin=com.sparrowwallet.sparrow
82 --add-opens=org.controlsfx.controls/impl.org.controlsfx.skin=javafx.fxml
83 --add-opens=javafx.graphics/com.sun.javafx.tk=centerdevice.nsmenufx
84 --add-opens=javafx.graphics/com.sun.javafx.tk.quantum=centerdevice.nsmenufx
85 --add-opens=javafx.graphics/com.sun.glass.ui=centerdevice.nsmenufx
86 --add-opens=javafx.controls/com.sun.javafx.scene.control=centerdevice.nsmenufx
87 --add-opens=javafx.graphics/com.sun.javafx.menu=centerdevice.nsmenufx
88 --add-opens=javafx.graphics/com.sun.glass.ui=com.sparrowwallet.sparrow
89 --add-opens=javafx.graphics/javafx.scene.input=com.sparrowwallet.sparrow
90 --add-opens=javafx.graphics/com.sun.javafx.application=com.sparrowwallet.sparrow
91 --add-opens=java.base/java.net=com.sparrowwallet.sparrow
92 --add-opens=java.base/java.io=com.google.gson
93 --add-opens=java.smartcardio/sun.security.smartcardio=com.sparrowwallet.sparrow
94 --add-reads=com.sparrowwallet.merged.module=java.desktop
95 --add-reads=com.sparrowwallet.merged.module=java.sql
96 --add-reads=com.sparrowwallet.merged.module=com.sparrowwallet.sparrow
97 --add-reads=com.sparrowwallet.merged.module=ch.qos.logback.classic
98 --add-reads=com.sparrowwallet.merged.module=org.slf4j
99 --add-reads=com.sparrowwallet.merged.module=com.fasterxml.jackson.databind
100 --add-reads=com.sparrowwallet.merged.module=com.fasterxml.jackson.annotation
101 --add-reads=com.sparrowwallet.merged.module=com.fasterxml.jackson.core
102 --add-reads=com.sparrowwallet.merged.module=co.nstant.in.cbor
103 --add-reads=kotlin.stdlib=kotlinx.coroutines.core
104 -m com.sparrowwallet.sparrow
107 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[@]} $@
110 torWrapper = writeScript "tor-wrapper" ''
113 exec ${tor}/bin/tor "$@"
116 jdk-modules = stdenvNoCC.mkDerivation {
117 name = "jdk-modules";
118 nativeBuildInputs = [ openjdk ];
122 # Extract the JDK's JIMAGE and generate a list of modules.
125 jimage extract ${openjdk}/lib/openjdk/lib/modules
126 ls | xargs -d " " -- echo > ../manifest.txt
132 cp manifest.txt $out/
137 sparrow-modules = stdenvNoCC.mkDerivation {
138 pname = "sparrow-modules";
140 nativeBuildInputs = [
146 (lib.getLib stdenv.cc.cc)
151 # Extract Sparrow's JIMAGE and generate a list of them.
154 jimage extract ../lib/runtime/lib/modules
157 cat ${jdk-modules}/manifest.txt | xargs -I {} -- rm -fR {}
159 # Delete unneeded native libs.
161 rm -fR com.sparrowwallet.merged.module/com/sun/jna/freebsd-x86-64
162 rm -fR com.sparrowwallet.merged.module/com/sun/jna/freebsd-x86
163 rm -fR com.sparrowwallet.merged.module/com/sun/jna/linux-aarch64
164 rm -fR com.sparrowwallet.merged.module/com/sun/jna/linux-arm
165 rm -fR com.sparrowwallet.merged.module/com/sun/jna/linux-armel
166 rm -fR com.sparrowwallet.merged.module/com/sun/jna/linux-mips64el
167 rm -fR com.sparrowwallet.merged.module/com/sun/jna/linux-ppc
168 rm -fR com.sparrowwallet.merged.module/com/sun/jna/linux-ppc64le
169 rm -fR com.sparrowwallet.merged.module/com/sun/jna/linux-s390x
170 rm -fR com.sparrowwallet.merged.module/com/sun/jna/linux-x86
171 rm -fR com.sparrowwallet.merged.module/com/sun/jna/openbsd-x86-64
172 rm -fR com.sparrowwallet.merged.module/com/sun/jna/openbsd-x86
173 rm -fR com.sparrowwallet.merged.module/com/sun/jna/sunos-sparc
174 rm -fR com.sparrowwallet.merged.module/com/sun/jna/sunos-sparcv9
175 rm -fR com.sparrowwallet.merged.module/com/sun/jna/sunos-x86-64
176 rm -fR com.sparrowwallet.merged.module/com/sun/jna/sunos-x86
177 rm -fR com.github.sarxos.webcam.capture/com/github/sarxos/webcam/ds/buildin/lib/linux_armel
178 rm -fR com.github.sarxos.webcam.capture/com/github/sarxos/webcam/ds/buildin/lib/linux_armhf
179 rm -fR com.github.sarxos.webcam.capture/com/github/sarxos/webcam/ds/buildin/lib/linux_x86
180 rm com.github.sarxos.webcam.capture/com/github/sarxos/webcam/ds/buildin/lib/linux_x64/OpenIMAJGrabber.so
181 rm -fR com.nativelibs4java.bridj/org/bridj/lib/linux_arm32_armel
182 rm -fR com.nativelibs4java.bridj/org/bridj/lib/linux_armel
183 rm -fR com.nativelibs4java.bridj/org/bridj/lib/linux_armhf
184 rm -fR com.nativelibs4java.bridj/org/bridj/lib/linux_x86
185 rm -fR com.nativelibs4java.bridj/org/bridj/lib/sunos_x64
186 rm -fR com.nativelibs4java.bridj/org/bridj/lib/sunos_x86
187 rm -fR com.sparrowwallet.merged.module/linux-aarch64
188 rm -fR com.sparrowwallet.merged.module/linux-arm
189 rm -fR com.sparrowwallet.merged.module/linux-x86
190 rm com.sparrowwallet.sparrow/native/linux/x64/hwi
192 ls | xargs -d " " -- echo > ../manifest.txt
193 find . | grep "\.so$" | xargs -- chmod ugo+x
196 # Replace the embedded Tor binary (which is in a Tar archive)
197 # with one from Nixpkgs.
198 gzip -c ${torWrapper} > tor.gz
199 cp tor.gz modules/kmp.tor.binary.linuxx64/kmptor/linux/x64/tor.gz
204 cp manifest.txt $out/
206 ln -s ${openimajgrabber}/lib/OpenIMAJGrabber.so $out/modules/com.github.sarxos.webcam.capture/com/github/sarxos/webcam/ds/buildin/lib/linux_x64/OpenIMAJGrabber.so
207 ln -s ${hwi}/bin/hwi $out/modules/com.sparrowwallet.sparrow/native/linux/x64/hwi
211 stdenvNoCC.mkDerivation rec {
213 pname = "sparrow-unwrapped";
214 nativeBuildInputs = [
221 name = "sparrow-desktop";
222 exec = "sparrow-desktop";
223 icon = "sparrow-desktop";
224 desktopName = "Sparrow Bitcoin Wallet";
225 genericName = "Bitcoin Wallet";
232 "application/bitcoin-transaction"
233 "x-scheme-handler/bitcoin"
234 "x-scheme-handler/auth47"
235 "x-scheme-handler/lightning"
237 startupWMClass = "Sparrow";
241 sparrow-icons = stdenvNoCC.mkDerivation {
243 pname = "sparrow-icons";
244 nativeBuildInputs = [ imagemagick ];
247 for n in 16 24 32 48 64 96 128 256; do
249 mkdir -p $out/hicolor/$size/apps
250 convert lib/Sparrow.png -resize $size $out/hicolor/$size/apps/sparrow-desktop.png
258 mkdir -p $out/bin $out
259 ln -s ${sparrow-modules}/modules $out/lib
260 install -D -m 777 ${launcher} $out/bin/sparrow-desktop
261 substituteAllInPlace $out/bin/sparrow-desktop
262 substituteInPlace $out/bin/sparrow-desktop --subst-var-by jdkModules ${jdk-modules}
264 mkdir -p $out/share/icons
265 ln -s ${sparrow-icons}/hicolor $out/share/icons
267 mkdir -p $out/etc/udev/rules.d
268 cp ${hwi}/lib/python*/site-packages/hwilib/udev/*.rules $out/etc/udev/rules.d
274 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";
275 homepage = "https://sparrowwallet.com";
276 sourceProvenance = with sourceTypes; [
280 license = licenses.asl20;
281 maintainers = with maintainers; [
285 platforms = [ "x86_64-linux" ];
286 mainProgram = "sparrow-desktop";