poetry2nix icon indicating copy to clipboard operation
poetry2nix copied to clipboard

Latest bcrypt version requires rust support

Open AlexChalk opened this issue 1 year ago • 1 comments

Describe the issue

A rust compiler is now required to build the bcrypt package, and this isn't specified in the poetry2nix overrides: https://github.com/nix-community/poetry2nix/blob/9fee29254a0ea0e6a4432cf36a71a2b7317c9767/overrides/default.nix#L198-L202

Additional context

It looks like there's already a pattern for solving this problem (https://github.com/nix-community/poetry2nix/issues/413), so I'm planning to just submit a PR that follows the cryptography approach when I have time: https://github.com/nix-community/poetry2nix/blob/9fee29254a0ea0e6a4432cf36a71a2b7317c9767/overrides/default.nix#L321-L364

Guidance on how to test this once I'm done would be welcome! Ideally I'd like to try and build the package using poetry2nix once I've made my changes, is this possible?

AlexChalk avatar Sep 29 '22 14:09 AlexChalk

Hardcoded cargo hashes feel hacky and probably is a burden to maintain. (I'm still a beginner with Nix; maybe it is supposed to be that way. But it feels the other way around)

I'm thinking if one can use rustPlatform.importCargoLock function instead? I just learned of its existence a while ago:

If a Cargo.lock file is available, you can alternatively use the importCargoLock function. In contrast to fetchCargoTarball, this function does not require a hash (unless git dependencies are used) and fetches every dependency as a separate fixed-output derivation. importCargoLock can be used as follows:

cargoDeps = rustPlatform.importCargoLock {
  lockFile = ./Cargo.lock;
};

source

The other day I managed to build another Python-Rust package that way: https://github.com/nix-community/poetry2nix/issues/731#issuecomment-1260669209

And from what I saw, cryptography tarball released on PyPi does include Cargo.lock file. Maybe it's worth trying.

rszamszur avatar Oct 01 '22 11:10 rszamszur