Skip to content

Commit 6157749

Browse files
authored
bitbox: init at 4.46.3 (#267064)
2 parents 1d0e98f + ae165c0 commit 6157749

File tree

7 files changed

+112
-0
lines changed

7 files changed

+112
-0
lines changed

maintainers/maintainer-list.nix

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21857,6 +21857,12 @@
2185721857
githubId = 2084639;
2185821858
name = "Manu";
2185921859
};
21860+
tensor5 = {
21861+
github = "tensor5";
21862+
githubId = 1545895;
21863+
matrix = "@tensor5:matrix.org";
21864+
name = "Nicola Squartini";
21865+
};
2186021866
teozkr = {
2186121867
email = "[email protected]";
2186221868
github = "nightkr";
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git a/frontends/qt/genassets.sh b/frontends/qt/genassets.sh
2+
index 4b1ba87be..b5a9ad279 100755
3+
--- a/frontends/qt/genassets.sh
4+
+++ b/frontends/qt/genassets.sh
5+
@@ -20,7 +20,7 @@ if [ ! -d ../web/build ]; then
6+
fi
7+
8+
echo '<!DOCTYPE RCC><RCC version="1.0"><qresource>' > assets.qrc
9+
-/usr/bin/find ../web/build/ -maxdepth 3 -type f | sed -e "s|../web/build/||" | awk '{ print "<file alias=\"" $1 "\">../web/build/" $1 "</file>" '} >> assets.qrc
10+
+find ../web/build/ -maxdepth 3 -type f | sort | sed -e "s|../web/build/||" | awk '{ print "<file alias=\"" $1 "\">../web/build/" $1 "</file>" '} >> assets.qrc
11+
12+
echo '<file alias="trayicon.png">resources/trayicon.png</file>' >> assets.qrc
13+
echo '</qresource></RCC>' >> assets.qrc

pkgs/by-name/bi/bitbox/package.nix

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
{
2+
lib,
3+
stdenv,
4+
fetchFromGitHub,
5+
buildNpmPackage,
6+
clang,
7+
go,
8+
libsForQt5,
9+
}:
10+
11+
stdenv.mkDerivation rec {
12+
pname = "bitbox";
13+
version = "4.46.3";
14+
15+
src = fetchFromGitHub {
16+
owner = "BitBoxSwiss";
17+
repo = "bitbox-wallet-app";
18+
rev = "v${version}";
19+
fetchSubmodules = true;
20+
hash = "sha256-2oGVQ022NGOHLo7TBdeXG3ng1nYW8fyLwSV0hJdAl9I=";
21+
};
22+
23+
patches = [
24+
./genassets.patch
25+
];
26+
27+
postPatch = ''
28+
substituteInPlace frontends/qt/resources/linux/usr/share/applications/bitbox.desktop \
29+
--replace-fail 'Exec=BitBox %u' 'Exec=bitbox %u'
30+
'';
31+
32+
dontConfigure = true;
33+
34+
passthru.web = buildNpmPackage {
35+
pname = "bitbox-web";
36+
inherit version;
37+
inherit src;
38+
sourceRoot = "source/frontends/web";
39+
npmDepsHash = "sha256-w98wwKHiZtor5ivKd+sh5K8HnAepu6cw9RyVJ+eTq3k=";
40+
installPhase = "cp -r build $out";
41+
};
42+
43+
buildPhase = ''
44+
runHook preBuild
45+
46+
ln -s ${passthru.web} frontends/web/build
47+
export GOCACHE=$TMPDIR/go-cache
48+
cd frontends/qt
49+
make -C server linux
50+
./genassets.sh
51+
qmake -o build/Makefile
52+
cd build
53+
make
54+
cd ../../..
55+
56+
runHook postBuild
57+
'';
58+
59+
installPhase = ''
60+
runHook preInstall
61+
62+
mkdir $out
63+
cp -r frontends/qt/resources/linux/usr/share $out
64+
mkdir $out/{bin,lib}
65+
cp frontends/qt/build/BitBox $out/bin/bitbox
66+
cp frontends/qt/build/assets.rcc $out/bin
67+
cp frontends/qt/server/libserver.so $out/lib
68+
install -Dt $out/lib/udev/rules.d ${./rules.d}/*
69+
70+
runHook postInstall
71+
'';
72+
73+
buildInputs = [ libsForQt5.qtwebengine ];
74+
75+
nativeBuildInputs = [
76+
clang
77+
go
78+
libsForQt5.wrapQtAppsHook
79+
];
80+
81+
meta = {
82+
description = "Companion app for the BitBox02 hardware wallet";
83+
homepage = "https://bitbox.swiss/app/";
84+
license = lib.licenses.asl20;
85+
mainProgram = "bitbox";
86+
maintainers = [ lib.maintainers.tensor5 ];
87+
platforms = [ "x86_64-linux" ];
88+
};
89+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
SUBSYSTEM=="usb", TAG+="uaccess", TAG+="udev-acl", SYMLINK+="dbb%n", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2402"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
KERNEL=="hidraw*", SUBSYSTEM=="hidraw", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2402", TAG+="uaccess", TAG+="udev-acl", SYMLINK+="dbbf%n"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
SUBSYSTEM=="usb", TAG+="uaccess", TAG+="udev-acl", SYMLINK+="bitbox02_%n", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2403"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
KERNEL=="hidraw*", SUBSYSTEM=="hidraw", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2403", TAG+="uaccess", TAG+="udev-acl", SYMLINK+="bitbox02-%n"

0 commit comments

Comments
 (0)