Skip to content
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

Add Nix flake (WIP) #335

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Add Nix flake (WIP) #335

wants to merge 1 commit into from

Conversation

jurraca
Copy link

@jurraca jurraca commented Oct 8, 2023

This flake exposes a package and a devShell to develop on Cashu and build the binaries.
With flakes enabled, run nix build from project root.
Tested only on Linux.

currently the cryptography package throws an error on "BN_Add" symbol.

@callebtc
Copy link
Collaborator

callebtc commented Oct 8, 2023

The error you've showed was related to the bitcoin library in Cashu which is used for P2SH. I could imagine that we can remove that functionality and with it the entire library from the code base.

Should I do that in a separate branch and you can merge it into this branch?

@jurraca
Copy link
Author

jurraca commented Oct 9, 2023

That works yes, thanks!

@callebtc callebtc mentioned this pull request Oct 13, 2023
@@ -17,7 +17,7 @@
from ...core.base import TokenV3
from ...core.helpers import sum_proofs
from ...core.settings import settings
from ...nostr.nostr.client.client import NostrClient
from nostr.client.client import NostrClient
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The imports must remain relative otherwise the library can't be imported by other applications. There might also be pip package issues when nostr is fetched from its repo.

@callebtc
Copy link
Collaborator

That works yes, thanks!

done!

@callebtc
Copy link
Collaborator

I also moved the nostr client directly into the repo: #346

remove setuptools override (relaxDeps takes care of it); remove empty extras

use nativebuildInputs instead of propagated for hatchling, which is a build dep

add comments, desc; update flake.lock

set nixos to 23.05, poetry2nix picks up bug on unstable

fix by including python-nostr and overriding python3 version with it, and fix its name; update lockfile

remove hack around nostr lib, remove nostr dependency from project files

remove nostr build from flake as the lib is now local to the repo
@jurraca
Copy link
Author

jurraca commented Oct 15, 2023

OK, updated to use the new nostr setup. Rebased and squashed.

  • Not sure if the poetry.lock updates here are useful are not, they were automatically generated.
  • This builds the cashu binaries successfully on my machine. Could some mac folk (@chrisguida maybe?) test it as well?
  • Starting the mint fails because it's looking for a tor PID in the directory, I'll look at this next.

@chrisguida
Copy link

I'll get to this in a week or so! Unfortunately traveling without my mac currently

@callebtc
Copy link
Collaborator

  • Starting the mint fails because it's looking for a tor PID in the directory, I'll look at this next.

Any idea where this comes from? Nothing in the repo knows about PID files afaik....

@chrisguida
Copy link

just attempted nix build on my mac. seems a hash wasn't specified somewhere?

> nix build
trace: warning: Unknown cryptography version: '41.0.3'. Please update getCargoHash.
error: hash mismatch in fixed-output derivation '/nix/store/q5zdnqdvji51gldarqrnmvr76q50z8gk-cryptography-41.0.3-vendor.tar.gz.drv':
         specified: sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
            got:    sha256-LQu7waympGUs+CZun2yDQd2gUUAgyisKBG5mddrfSo0=
error: 1 dependencies of derivation '/nix/store/0mqas2hvyns7ipciy0c1mfcs9g4jkskm-python3.10-cryptography-41.0.3.drv' failed to build
error: 1 dependencies of derivation '/nix/store/wxr9qh49r05vhk6mkzm06nb85jqhnqm1-python3.10-cashu-0.14.0.drv' failed to build

@jurraca
Copy link
Author

jurraca commented Oct 26, 2023

Any idea where this comes from?

not sure but it... disappeared

seems a hash wasn't specified somewhere?

We're avoiding specifying a hash by overriding cryptography with preferWheels = true so it doesn't try to do a fixed-output derivation. I can reproduce if i don't override the cryptography lib. It's basically this error. Maybe there's an extra mac thing to do?

@chrisguida
Copy link

Hmm ok, what's the workaround? Should I copy this hash somewhere?

@jurraca
Copy link
Author

jurraca commented Oct 27, 2023

idk tbh. This works on linux, not sure why it fails for mac.

@callebtc
Copy link
Collaborator

Would love this to work on mac as I'm also one of those people!

@callebtc
Copy link
Collaborator

Could you guys add a git workflow that checks whether the flake works as the repo might get updated?

@codecov
Copy link

codecov bot commented Oct 29, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (3e58670) 68.01% compared to head (93dfdf0) 67.97%.
Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #335      +/-   ##
==========================================
- Coverage   68.01%   67.97%   -0.05%     
==========================================
  Files          63       63              
  Lines        4834     4834              
==========================================
- Hits         3288     3286       -2     
- Misses       1546     1548       +2     

see 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants