-
Init your project with this template
$ nix flake init --template "github:nixvital/flake-templates#maturin-basics"
-
Get into the devshell by
$ nix develop .
-
Now, use
maturin
to initialize your project, and choosepyo3
.$ maturin init
-
Write code!
If you are using virtualenv
or conda
, maturin develop
is probably the way to go. However, it does not work for this nix-based development environment (let me know if you have a better idea to get maturin develop
working!)
For now, I provided the packaging of the resulting python package in the template.
You will need to adapt it to your project by
- Update the name and version of package
- The hash for the
cargoDeps
will also need to be updated- Note: I usually just build it once and let it complain and show the true hash
- Add your dependencies.
To test the package in a devshell, run nix develop .#test
.