I've tried a bunch of things to get my project to create a result-dist folder with a wheel I can publish to PyPI. Somehow, even though I'm using a nixpkgs version with pythonOutputDistHook in it, I only ever get a result folder, not a result-dist folder.

My investigation so far:

  1. pythonOutputDistHook is optional based on withDistOutput.

  2. withDistOutput is true if format contains one of ["pyproject" "setuptools" "flit"].

  3. format ? "setuptools" and my code doesn't set format, so pythonOutputDistHook should be included.

  4. I've verified that pythonOutputDistHook is in my nixpkgs:

    $ cd nixpkgs
    $ git checkout 9c14978f845f33b152f722709caf42148580a30c
    HEAD is now at 9c14978f845 Merge master into staging-next
    $ git grep pythonOutputDistHook
    pkgs/development/interpreters/python/hooks/default.nix:  pythonOutputDistHook = callPackage ({ }:
    pkgs/development/interpreters/python/mk-python-derivation.nix:, pythonOutputDistHook
    pkgs/development/interpreters/python/mk-python-derivation.nix:      pythonOutputDistHook
    pkgs/top-level/python-packages.nix:    pythonOutputDistHook

Could something be injecting a different pkgs argument into one of the Nix files?

1 Answer 1


The standard builder in Nixpkgs (stdenv.mkDerivation) can create multiple outputs. Some typical outputs are the default output out but also lib, bin, dev and doc. Any derivation can specify which outputs it creates. Outputs can be referred to directly:

$ nix-build -A bash.dev

Since recently, buildPythonPackage (which calls stdenv.mkDerivation behind the scenes), creates a dist output that contains artifacts for distribution, specifically, wheels:

$ find $(nix-build -A python3.pkgs.pytest.dist)
  • Basically, nix-build -A dist does the trick.
    – l0b0
    Sep 30, 2022 at 13:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .