Python development nix-build failing while nix-shell succeeds

I have a default.nix that looks like so:

buildPythonPackage rec {
  name = "babelfish";
  src = "./.";
  doCheck = false;
  checkPhase = ''
    python -m unittest discover
  '';
  propagatedBuildInputs = [
    matplotlib
    numpy
 ];
}

When I do nix-shell, this works and I can import my package fine. However, nix-build gives:

these derivations will be built:
  /nix/store/j5m15a0xfxn9r987z5827hpff46fk203-python3.7-babelfish.drv
building '/nix/store/j5m15a0xfxn9r987z5827hpff46fk203-python3.7-babelfish.drv'...
Sourcing python-catch-conflicts-hook.sh
Sourcing python-remove-bin-bytecode-hook.sh
Sourcing setuptools-build-hook
Using setuptoolsBuildPhase
Using setuptoolsShellHook
Sourcing pip-install-hook
Using pipInstallPhase
Sourcing python-imports-check-hook.sh
Using pythonImportsCheckPhase
unpacking sources
unpacking source archive ./.
cp: './.' and './.' are the same file
do not know how to unpack source archive ./.
builder for '/nix/store/j5m15a0xfxn9r987z5827hpff46fk203-python3.7-babelfish.drv' failed with exit code 1
error: build of '/nix/store/j5m15a0xfxn9r987z5827hpff46fk203-python3.7-babelfish.drv' failed

Any idea what Iā€™m missing?

src should be a path, not a string. Remove the double quotes.

1 Like