I am not able to solve this problem with the poetry2nix.
This is my simple derivation
let
# Import nixpkgs
pkgs = import <nixpkgs> { };
# Import poetry2nix and its functions
poetry2nix = pkgs.poetry2nix;
# Create a Python environment using poetry2nix
baseEnv = poetry2nix.mkPoetryEnv {
python = pkgs.python310;
projectDir = ./.;
poetrylock = ./poetry.lock; # Path to your poetry.lock file
};
finalEnv = baseEnv.overrideAttrs (oldAttrs: {
buildInputs = oldAttrs.buildInputs ++ [ pkgs.python310Packages.hatchling ];
});
in
with pkgs;
stdenv.mkDerivation {
name = "git-dev-nix-env";
buildInputs = [
gcc
sqlite
autoconf
git
clang
libtool
sqlite
autoconf
autogen
automake
gnumake
pkg-config
gmp
zlib
gettext
libsodium
# Python dep
poetry
python310
python310Packages.pip
python310Packages.pytest
baseEnv # Add the poetry environment here
# optional dev libraries
ccache
# debugs libraries
valgrind
# Indirected dependencies for running tests
bitcoind
];
}
But my nix-shell fails with
error: builder for '/nix/store/pq31ss6pdxdxppy7p2w4v8gdcibvhvn7-python3.10-attrs-23.1.0.drv' failed with exit code 2;
last 10 log lines:
> File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
> File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
> File "<frozen importlib._bootstrap>", line 992, in _find_and_load_unlocked
> File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
> File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
> File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
> File "<frozen importlib._bootstrap>", line 1004, in _find_and_load_unlocked
> ModuleNotFoundError: No module named 'hatchling'
>
>
For full logs, run 'nix log /nix/store/pq31ss6pdxdxppy7p2w4v8gdcibvhvn7-python3.10-attrs-23.1.0.drv'.
error (ignored): error: cannot unlink '/tmp/nix-build-python3.10-base58-2.1.1.drv-1/base58-2.1.1': Directory not empty
error: 1 dependencies of derivation '/nix/store/xbaxapcgg0hgzjx5mbj3lk5vaxkl3x95-python3-3.10.12-env.drv' failed to build
Any idea on how to solve this?