10gic / vanitygen-plusplus

A vanity address generator for BTC, ETH, LTC, TRX and 100+ more crypto currencies.
GNU Affero General Public License v3.0
248 stars 90 forks source link

add a default.nix build file for easy builds of this on nix/nixOS #48

Closed pmarreck closed 1 year ago

pmarreck commented 1 year ago

just added a default.nix file to get this to build trivially on nixOS or nix, for those of us who prefer that distro/package manager. =)

10gic commented 1 year ago

@pmarreck It seems default.nix use openssl v1, but openssl v3 is needed for generating BTC addresses in the p2wpkh or p2tr formats. I'm not familiar with nix-build, could you help to resolve the related issue https://github.com/10gic/vanitygen-plusplus/issues/53 ?

pmarreck commented 1 year ago

@10gic I can try to have a look tonight

pmarreck commented 1 year ago

@10gic The build inputs specify openssl (unversioned) which according to https://search.nixos.org/packages?channel=22.11&from=0&size=50&sort=relevance&type=packages&query=openssl should install version 3.0.7 at this time; if I wanted to install openssl v1 I'd have to add openssl_1_1 as an input, as far as I know (and I don't know if they can be installed alongside each other). Do you still have the issue? If so, might not be a versioning issue.

Also, related, might be nice to have a test suite just to verify a built vanitygen can actually do what it claims to for when we add commits like I did (I had no idea I broke something because I never tried that type of gen)... It wouldn't be hard to just write a bash test script that verifies its functionality by running it against some (easily-achieved, like only first 1 or 2 characters) gen requests.

pmarreck commented 1 year ago

I commented on the linked issue, considering the possibility that you tried the build with a "tainted" (not pure) environment.

This is one of the nice things about nixos that avoids problems like this (IF you use it that way); by being very explicit about what a given build needs, and starting in a "pure" environment with it (where NOTHING it doesn't specify is visible to that environment, such as other "wrong" versions of packages you need), you should always get exactly what you expected from the build.

Let me know if that was in fact the problem and if my solution (running nix-shell --pure first) fixed it.

The "flakes" version of Nix (which is arguably better, it's basically "Nix 2.0", and which I didn't use here, unfortunately, as I'm still learning Nix!), has the command nix develop which if I recall correctly defaults to running "pure" (and in that case you have to manually add the --impure flag to intentionally leak your "standard" environment into your develop one)