diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix index f58e58e88aef7..08cc1639bd0f4 100644 --- a/maintainers/maintainer-list.nix +++ b/maintainers/maintainer-list.nix @@ -19707,6 +19707,12 @@ githubId = 2084639; name = "Manu"; }; + tensor5 = { + github = "tensor5"; + githubId = 1545895; + matrix = "@tensor5:matrix.org"; + name = "Nicola Squartini"; + }; teozkr = { email = "teo@nullable.se"; github = "nightkr"; diff --git a/pkgs/by-name/bi/bitbox/genassets.patch b/pkgs/by-name/bi/bitbox/genassets.patch new file mode 100644 index 0000000000000..9bcb1bb88b0a8 --- /dev/null +++ b/pkgs/by-name/bi/bitbox/genassets.patch @@ -0,0 +1,26 @@ +diff --git a/frontends/qt/Makefile b/frontends/qt/Makefile +index 5ab350554..49d07c0e0 100644 +--- a/frontends/qt/Makefile ++++ b/frontends/qt/Makefile +@@ -16,7 +16,7 @@ include ../../env.mk.inc + + base: + mkdir build +- ./genassets.sh ++ bash genassets.sh + qmake -set MACOS_MIN_VERSION $(MACOS_MIN_VERSION) + qmake -o build/Makefile + cd build && $(MAKE) +diff --git a/frontends/qt/genassets.sh b/frontends/qt/genassets.sh +index 4b1ba87be..b5a9ad279 100755 +--- a/frontends/qt/genassets.sh ++++ b/frontends/qt/genassets.sh +@@ -20,7 +20,7 @@ if [ ! -d ../web/build ]; then + fi + + echo '' > assets.qrc +-/usr/bin/find ../web/build/ -maxdepth 3 -type f | sed -e "s|../web/build/||" | awk '{ print "../web/build/" $1 "" '} >> assets.qrc ++find ../web/build/ -maxdepth 3 -type f | sort | sed -e "s|../web/build/||" | awk '{ print "../web/build/" $1 "" '} >> assets.qrc + + echo 'resources/trayicon.png' >> assets.qrc + echo '' >> assets.qrc diff --git a/pkgs/by-name/bi/bitbox/package.nix b/pkgs/by-name/bi/bitbox/package.nix new file mode 100644 index 0000000000000..378735578ea54 --- /dev/null +++ b/pkgs/by-name/bi/bitbox/package.nix @@ -0,0 +1,84 @@ +{ + lib, + stdenv, + fetchFromGitHub, + buildNpmPackage, + clang, + go, + libsForQt5, +}: + +stdenv.mkDerivation rec { + pname = "bitbox"; + version = "4.45.0"; + + src = fetchFromGitHub { + owner = "BitBoxSwiss"; + repo = "bitbox-wallet-app"; + rev = "v${version}"; + fetchSubmodules = true; + hash = "sha256-miy7uLNWvLacLOrlpsUE/nR/JNBkcueJX8/mX+abeAg="; + }; + + patches = [ + ./genassets.patch + ]; + + postPatch = '' + substituteInPlace frontends/qt/resources/linux/usr/share/applications/bitbox.desktop \ + --replace-fail 'Exec=BitBox %u' 'Exec=bitbox %u' + ''; + + dontConfigure = true; + + passthru.web = buildNpmPackage { + pname = "bitbox-web"; + inherit version; + inherit src; + sourceRoot = "source/frontends/web"; + npmDepsHash = "sha256-DylU/32t70r/wgjMDBMbaS7egU5DHx7ST7MlZp2zPiw="; + installPhase = "cp -r build $out"; + }; + + buildPhase = '' + runHook preBuild + + ln -s ${passthru.web} frontends/web/build + export GOCACHE=$TMPDIR/go-cache + make -C frontends/qt/server linux + make -C frontends/qt base + + runHook postBuild + ''; + + installPhase = '' + runHook preInstall + + mkdir $out + cp -r frontends/qt/resources/linux/usr/share $out + mkdir $out/{bin,lib} + cp frontends/qt/build/BitBox $out/bin/bitbox + cp frontends/qt/build/assets.rcc $out/bin + cp frontends/qt/server/libserver.so $out/lib + install -Dt $out/lib/udev/rules.d ${./rules.d}/* + + runHook postInstall + ''; + + buildInputs = [ libsForQt5.qtwebengine ]; + + nativeBuildInputs = [ + clang + go + libsForQt5.wrapQtAppsHook + ]; + + meta = { + description = "Companion app for the BitBox02 hardware wallet"; + homepage = "https://bitbox.swiss/app/"; + license = lib.licenses.asl20; + mainProgram = "bitbox"; + maintainers = [ lib.maintainers.tensor5 ]; + platforms = [ "x86_64-linux" ]; + }; +} diff --git a/pkgs/by-name/bi/bitbox/rules.d/51-hid-digitalbitbox.rules b/pkgs/by-name/bi/bitbox/rules.d/51-hid-digitalbitbox.rules new file mode 100644 index 0000000000000..94c86203afaf7 --- /dev/null +++ b/pkgs/by-name/bi/bitbox/rules.d/51-hid-digitalbitbox.rules @@ -0,0 +1 @@ +SUBSYSTEM=="usb", TAG+="uaccess", TAG+="udev-acl", SYMLINK+="dbb%n", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2402" diff --git a/pkgs/by-name/bi/bitbox/rules.d/52-hid-digitalbitbox.rules b/pkgs/by-name/bi/bitbox/rules.d/52-hid-digitalbitbox.rules new file mode 100644 index 0000000000000..84fe717211d51 --- /dev/null +++ b/pkgs/by-name/bi/bitbox/rules.d/52-hid-digitalbitbox.rules @@ -0,0 +1 @@ +KERNEL=="hidraw*", SUBSYSTEM=="hidraw", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2402", TAG+="uaccess", TAG+="udev-acl", SYMLINK+="dbbf%n" diff --git a/pkgs/by-name/bi/bitbox/rules.d/53-hid-bitbox02.rules b/pkgs/by-name/bi/bitbox/rules.d/53-hid-bitbox02.rules new file mode 100644 index 0000000000000..2daffc03bad26 --- /dev/null +++ b/pkgs/by-name/bi/bitbox/rules.d/53-hid-bitbox02.rules @@ -0,0 +1 @@ +SUBSYSTEM=="usb", TAG+="uaccess", TAG+="udev-acl", SYMLINK+="bitbox02_%n", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2403" diff --git a/pkgs/by-name/bi/bitbox/rules.d/54-hid-bitbox02.rules b/pkgs/by-name/bi/bitbox/rules.d/54-hid-bitbox02.rules new file mode 100644 index 0000000000000..1b74e47743043 --- /dev/null +++ b/pkgs/by-name/bi/bitbox/rules.d/54-hid-bitbox02.rules @@ -0,0 +1 @@ +KERNEL=="hidraw*", SUBSYSTEM=="hidraw", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2403", TAG+="uaccess", TAG+="udev-acl", SYMLINK+="bitbox02-%n"