-
-
Notifications
You must be signed in to change notification settings - Fork 15.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
digitalbitbox: init at 2.2.2 #33787
digitalbitbox: init at 2.2.2 #33787
Conversation
I recently learned about |
216fce0
to
0a3030f
Compare
cp src/libbtc/src/secp256k1/.libs/*.so* $out/lib | ||
cp src/hidapi/libusb/.libs/*.so* $out/lib | ||
cp src/univalue/.libs/*.so* $out/lib | ||
rm -rf $PWD |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not needed, the build directory will be cleaned up by nix automatically
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not removing $PWD results to a forbidden reference error. I once found this as a temporary fix on a nixpkgs issue/pr thread.
rm -rf $PWD | ||
|
||
mkdir -p "$out/etc/udev/rules.d" | ||
printf "SUBSYSTEM==\"usb\", TAG+=\"uaccess\", TAG+=\"udev-acl\", SYMLINK+=\"dbb%%n\", ATTRS{idVendor}==\"03eb\", ATTRS{idProduct}==\"2402\"\n" | tee $out/etc/udev/rules.d/51-hid-digitalbitbox.rules > /dev/null && printf "KERNEL==\"hidraw*\", SUBSYSTEM==\"hidraw\", ATTRS{idVendor}==\"03eb\", ATTRS{idProduct}==\"2402\", TAG+=\"uaccess\", TAG+=\"udev-acl\", SYMLINK+=\"dbbf%%n\"\n" | tee $out/etc/udev/rules.d/52-hid-digitalbitbox.rules > /dev/null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why | tee file > /dev/null
instead of directly > file
?
Also put these 2 printf's on separate lines, the &&
doesn't seem needed. And you can use single quotes ('
) to not need the %%
and \"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I copied this from the package's docs. I figured it's easier to maintain parity to the package's instructions in case things change in the future. Otherwise, the person updating this would have to translate that "printf | tee" bit with the added risk of human error.
makeWrapper, | ||
pkgconfig, | ||
qt59, | ||
withDebug ? false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is having this option worth it? Why make it configurable explicitly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stripped the option out with 0c5f3d6
in stdenv.mkDerivation rec { | ||
name = "dbb-app-${version}"; | ||
|
||
meta = with stdenv.lib; { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: The meta section is usually at the very bottom
debugFlag = optionalString withDebug "--enable-debug"; | ||
in '' | ||
./autogen.sh | ||
./configure --prefix=$out ${debugFlag} --enable-libusb $configureFlags |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please set the configureFlags
attribute (it's a list) and use the default configurePhase for autogen (something like including pkgs.autogen
in nativeBuildInputs
should do it). Then it's also easy to add the --enable-debug
flag for people that need it and you won't have to add an option for it.
]; | ||
|
||
installPhase = '' | ||
make install |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider also using the default installPhase (which is make install
) and add additional stuff with postInstall
. I'm not exactly sure on this though.
I just added separate commits, which I can squash once the review is positive 😉. I'm trying to test this against the real hardware but am having issues with the udev rules. When one installs this package they get to add a My first approach was to checkout this branch and attempt to Another approach would be to rebase this entire branch on top of my current @infinisil how would you go about this? Thanks for the assistance on this 🙇 |
Rebasing is perfectly fine. As for the |
Also another nitpick, I've listed the package under the all-packages attribute @emmanuelrosa thanks for the tip. I'll be working on the module next 😉 was looking at the nitrokey, which is relatively similar to what you explained. They added their module in As for my other problem. I basically rebased all my work and then cherry-picked it on top of |
d6e05be
to
865ae77
Compare
So here's the current status. The easiest way to install the Digitalbitbox application is by adding {
programs.digitalbitbox.enable = true;
} to your nixos-configuration which will install the That {
environment.systemPackages = [ pkgs.digitalbitbox ];
hardware.digitalbitbox.enable = true;
} The hardware module for digitalbitbox simply allows the udev rules by means of {
services.udev.packages = [ pkgs.digitalbitbox ];
} |
This is looking great 👍 What plan do you have to guide users toward the proper installation procedure? A user may simply try adding |
Hey @emmanuelrosa, I don't really have a good plan there. I was thinking about:
I think option 1 suffices for now, wouldn't you agree? I don't see a good place where I could make a note of this in the NixOS docs and the Digital Bitbox linux installation page is relatively distro agnostic. Not sure they want to start venturing down that road where they'll have to keep and maintain installation instructions for different distros. Which options do you have mind that I haven't listed yet? |
606b8e7
to
83cabc9
Compare
Option 1 is very good. The NixOS documentation has a section containing application-specific instructions. Here's an example of one that's short and sweet: https://nixos.org/nixos/manual/index.html#sec-hidepid Packages can optionally have a long description in the You're right, discover-ability is tough at this point. Hopefully between the code comments, docs, and perhaps also a mention in the package's description, users will find what they need. |
83cabc9
to
95ea7c8
Compare
Okay... I've added the About the manual... the example you gave pertains to a rather general security feature. Structure-wise, I don't think that it would make sense for every maintainer to add information on the usage details for their packages to the manual. I foresee this document becoming a cloud of noise in which it becomes even harder to find things. Perhaps, I misunderstood you in which case I hope you'll help me clarify what you meant. |
Yeah, that was a bad example on my part. A better one is the Emacs chapter. My reasoning behind suggesting that you add instructions to the NixOS documentation is that your package requires an abnormal install process. You're right, the documentation should not contain usage details for every package. But documentation is ideal for installs that require something other than the common My goal is to make the NixOS learning curve shallower (that sounds awful, I know) to encourage more talent to saddle up and become contributors, just like you and I. |
The commits that lead to this have been squashed from independent commits see branch @vidbina/add/digitalbitbox-wip that did the following: - 0a3030f digitalbitbox: init at 2.2.2 - c18ffa3ffd4 digitalbitbox: moved meta to EOF - 0c5f3d6 digitalbitbox: using preConfigure + configureFlags - a85b1df digitalbitbox: nativeBuildInputs - 90bdd35 digitalbitbox: autoreconfHook - 91810ee digitalbitbox: default installPhase & makeWrapper - 90e43fb digitalbitbox: doc rm $PWD hack & printf-tee deal - fd033b2 digitalbitbox: cleanup, alphabetically sort attrs - c590798 digitalbitbox: added hardware module - 88e46bc digitalbitbox: added program module - ammend to change name: dbb-app -> digitalbitbox - ammend to add install instructions based on feedback (NixOS#33787 (comment)) - ammend to add longDescription
95ea7c8
to
738ad86
Compare
738ad86
to
59f1332
Compare
59f1332
to
282f02d
Compare
The commits that lead to this have been squashed from independent commits see branch @vidbina/add/digitalbitbox-wip that did the following: - 0a3030f digitalbitbox: init at 2.2.2 - c18ffa3ffd4 digitalbitbox: moved meta to EOF - 0c5f3d6 digitalbitbox: using preConfigure + configureFlags - a85b1df digitalbitbox: nativeBuildInputs - 90bdd35 digitalbitbox: autoreconfHook - 91810ee digitalbitbox: default installPhase & makeWrapper - 90e43fb digitalbitbox: doc rm $PWD hack & printf-tee deal - fd033b2 digitalbitbox: cleanup, alphabetically sort attrs - c590798 digitalbitbox: added hardware module - 88e46bc digitalbitbox: added program module - amend to change name: dbb-app -> digitalbitbox - amend to add install instructions based on feedback (NixOS#33787 (comment)) - amend to add longDescription - moved program to its own dir - overridable udev rules handling - added docs to manual - added package attr to program module - added package attr to hardware module
282f02d
to
7ece374
Compare
|
||
<para> | ||
Digital Bitbox is a hardware wallet and second-factor authenticator. | ||
</para> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Props for writing this documentation!
Thanks for the pull request. Looked pretty good! |
@Mic92 thanks for reviewing. This PR has been straddling along for quite a while, after the multiple review session it's at least good to know the outcome was relatively decent acceptable or decent 😄. |
Motivation for this change
I just got a digitalbitbox to play around with and couldn't find the apps (searched for
dbb
ordigitalbitbox
) in the nixpkgs index (or any PR or issue for that matter) so here goes...For context's sake: Squashed it from this branch on top of the latest master which followed from this branch based on my
nixos-version --revision
. Maybe that helps clarify some decisions made; however messy.Things done
build-use-sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)