I’m trying to understand the buildPythonPackage
function used to package python libraries,
In my understanding the following code should build:
{
pkgs ? import <nixpkgs> { },
}:
with pkgs;
with pkgs.python3Packages;
let
hr = buildPythonPackage rec {
pname = "hiredis";
version = "1.0.1";
src = fetchPypi {
pname = "hiredis";
inherit version;
sha256 = "sha256-qlndY7s/c23k/C0IARRCnV02nfsyZfdxd46DSdZ6l6Q=";
};
dependencies = [ ];
doCheck = false;
nativeBuildInputs = [ openssl ];
disabledTests = [ ];
pythonImportsCheck = [ "hiredis" ];
};
hiredisPkg = callPackage hr { };
in
mkShell { buildInputs = [ hiredisPkg ]; }
However it fails with
nix-shell
error:
… while calling the 'derivationStrict' builtin
at /builtin/derivation.nix:9:12: (source not available)
… while evaluating derivation 'nix-shell'
whose name attribute is located at /nix/store/0qd773b63yg8435w8hpm13zqz7iipcbs-source/pkgs/stdenv/generic/make-derivation.nix:331:7
… while evaluating attribute 'buildInputs' of derivation 'nix-shell'
at /nix/store/0qd773b63yg8435w8hpm13zqz7iipcbs-source/pkgs/stdenv/generic/make-derivation.nix:378:7:
377| depsHostHost = elemAt (elemAt dependencies 1) 0;
378| buildInputs = elemAt (elemAt dependencies 1) 1;
| ^
379| depsTargetTarget = elemAt (elemAt dependencies 2) 0;
error: opening file '/nix/store/bkm7w97sf1rxsm9jvkng1pdsjw2rvcig-python3.11-hiredis-1.0.1/default.nix': No such file or directory
I’m not sure why the builder looks out for default.nix
here.