···
18
+
, SUBSYSTEM=="usb", TAG+="uaccess", TAG+="udev-acl", SYMLINK+="dbb%n", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2402"
21
+
, KERNEL=="hidraw*", SUBSYSTEM=="hidraw", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2402", TAG+="uaccess", TAG+="udev-acl", SYMLINK+="dbbf%n"
26
+
# Enabling the digitalbitbox program
28
+
# programs.digitalbitbox.enable = true;
30
+
# will install the digitalbitbox package and enable the corresponding hardware
31
+
# module and is by far the easiest way to get started with the Digital Bitbox on
34
+
# In case you install the package only, please be aware that you may need to
35
+
# apply some udev rules to allow the application to identify and access your
36
+
# wallet. In a nixos-configuration, one may accomplish this by enabling the
37
+
# digitalbitbox hardware module
39
+
# hardware.digitalbitbox.enable = true;
41
+
# or by adding the digitalbitbox package to system.udev.packages
43
+
# system.udev.packages = [ pkgs.digitalbitbox ];
45
+
# See https://digitalbitbox.com/start_linux for more information.
47
+
copyUdevRuleToOutput = name: rule:
48
+
"cp ${writeText name rule} $out/etc/udev/rules.d/${name}";
49
+
in stdenv.mkDerivation rec {
50
+
name = "digitalbitbox-${version}";
53
+
src = fetchFromGitHub {
54
+
owner = "digitalbitbox";
56
+
rev = "v${version}";
57
+
sha256 = "1r77fvqrlaryzij5dfbnigzhvg1d12g96qb2gp8dy3xph1j0k3s1";
60
+
nativeBuildInputs = with stdenv.lib; [
69
+
buildInputs = with stdenv.lib; [
81
+
LUPDATE="${qttools.dev}/bin/lupdate";
82
+
LRELEASE="${qttools.dev}/bin/lrelease";
83
+
MOC="${qtbase.dev}/bin/moc";
84
+
QTDIR="${qtbase.dev}";
85
+
RCC="${qtbase.dev}/bin/rcc";
86
+
UIC="${qtbase.dev}/bin/uic";
92
+
hardeningDisable = [
98
+
cp src/libbtc/.libs/*.so* $out/lib
99
+
cp src/libbtc/src/secp256k1/.libs/*.so* $out/lib
100
+
cp src/hidapi/libusb/.libs/*.so* $out/lib
101
+
cp src/univalue/.libs/*.so* $out/lib
103
+
# [RPATH][patchelf] Avoid forbidden reference error
106
+
wrapProgram "$out/bin/dbb-cli" --prefix LD_LIBRARY_PATH : "$out/lib"
107
+
wrapProgram "$out/bin/dbb-app" --prefix LD_LIBRARY_PATH : "$out/lib"
109
+
# Provide udev rules as documented in https://digitalbitbox.com/start_linux
110
+
mkdir -p "$out/etc/udev/rules.d"
111
+
${copyUdevRuleToOutput "51-hid-digitalbox.rules" udevRule51}
112
+
${copyUdevRuleToOutput "52-hid-digitalbox.rules" udevRule52}
115
+
meta = with stdenv.lib; {
116
+
description = "A QT based application for the Digital Bitbox hardware wallet";
117
+
longDescription = ''
118
+
Digital Bitbox provides dbb-app, a GUI tool, and dbb-cli, a CLI tool, to manage Digital Bitbox devices.
120
+
This package will only install the dbb-app and dbb-cli, however; in order for these applications to identify and access Digital Bitbox devices, one may want to enable the digitalbitbox hardware module by adding
122
+
hardware.digitalbitbox.enable = true;
124
+
to the configuration which is equivalent to adding this package to the udev.packages list.
127
+
The easiest way to use the digitalbitbox package in NixOS is by adding
129
+
programs.digitalbitbox.enable = true;
131
+
to the configuration which installs the package and enables the hardware module.
133
+
homepage = "https://digitalbitbox.com/";
134
+
license = licenses.mit;
135
+
maintainers = with maintainers; [
138
+
platforms = platforms.linux;