Building Python Package (beancount-import) - "do not know how to unpack source archive"

This is the first time I’m trying to make a nix derivation to build a python project. I have my own custom version of the python package GitHub - jbms/beancount-import: Web UI for semi-automatically importing external data into beancount (note that my custom version is stored locally) and I’m trying to build it to import into a shell.nix

{ pkgs ? import <nixpkgs> {}, 
  unstable-pkgs ? import (fetchTarball {}

	my_beancount_import = unstable-pkgs.python3Packages.buildPythonPackage {
		pname = "beancount-import";
		version = "0.1";
		src = "/home/myusername/MyRepos/beancount_import";
pkgs.mkShell {
	buildInputs = with unstable-pkgs; [ 

However when the derivation is trying to be built, it ends up with the error do not know how to unpack source archive.

this derivation will be built:
building '/nix/store/ah6wk5347i4dxs4sk6c8w0z6sariy4wp-python3.10-beancount-import-0.1.drv'...
Sourcing python-remove-tests-dir-hook
Sourcing setuptools-build-hook
Using setuptoolsBuildPhase
Using setuptoolsShellHook
Sourcing pip-install-hook
Using pipInstallPhase
Using pythonImportsCheckPhase
Sourcing python-namespaces-hook
Sourcing setuptools-check-hook
Using setuptoolsCheckPhase
unpacking sources
unpacking source archive /home/myusername/MyRepos/beancount_import
do not know how to unpack source archive /home/myusername/MyRepos/beancount_import
error: builder for '/nix/store/ah6wk5347i4dxs4sk6c8w0z6sariy4wp-python3.10-beancount-import-0.1.drv' failed with exit code 1;

The repository has a that is unaltered from the main repository. What is going wrong/how do I fix this?

Thanks in advance.

1 Like

Locally as in a directory? The stdenv generally expects some kind of compressed source.

I think you can set doUnpack = false; to skip the attempt to unpack.

Edit: dontUnpack = true; :slight_smile:

1 Like

Ah ok, yes I do mean in a directory.

Where do I place the doUnpack? I can’t seem to find documentation on it.

Sorry–I inverted the name: dontUnpack = true;

You’d put it in the buildPythonPackage block.

1 Like

So for future reference, the dontUnpack = true; works as an option however didn’t actually work for the overall workflow.

When researching as to why dontUnpack didn’t work, I came across pkgs.lib.cleanSource which seems to do the job as follows:

src = pkgs.lib.cleanSource "/home/myusername/MyRepos/beancount-import";
1 Like