Python3.8 sphinx build failure on unstable

I tried to update my system with nix flake update:

• Updated input 'home-manager':
    'github:nix-community/home-manager/68eaf4b577cfa8024fb910a1ce7d60385044f798' (2023-04-16)
  → 'github:nix-community/home-manager/5db22bce05c776057fdb289da17f6c12049c4624' (2023-06-14)
• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/f294325aed382b66c7a188482101b0f336d1d7db' (2023-04-16)
  → 'github:NixOS/nixpkgs/75a5ebf473cd60148ba9aec0d219f72e5cf52519' (2023-06-11)

and then sudo nixos-rebuild switch --flake .#nixos-dell --show-trace today, and I get this failure:

error: builder for '/nix/store/1nihi2jk6p9rffgfs8bb88rqj7mivchx-python3.8-3.8.17-doc.drv' failed with exit code 2;
       last 10 log lines:
       >     label = translators['sphinx'].gettext(label)
       > KeyError: 'sphinx'
       >
       > Exception occurred:
       >   File "/build/Python-3.8.17/Doc/tools/extensions/pyspecific.py", line 360, in run
       >     label = translators['sphinx'].gettext(label)
       > KeyError: 'sphinx'
       > The full traceback has been saved in /build/sphinx-err-opdtgdk0.log, if you want to report the issue to the developers.
       > Please also report this if it was a user error, so that a better error message can be provided next time.
       > A bug report can be filed in the tracker at <https://github.com/sphinx-doc/sphinx/issues>. Thanks!
       For full logs, run 'nix log /nix/store/1nihi2jk6p9rffgfs8bb88rqj7mivchx-python3.8-3.8.17-doc.drv'.
error: 1 dependencies of derivation '/nix/store/gw8h8dz8daj54jr4k4pqw6b6fdyiccja-system-path.drv' failed to build
error: 1 dependencies of derivation '/nix/store/7ihp7vvd2wrjpfz6b6lly3l35qaw4vx0-nixos-system-nixos-dell-23.11.20230611.75a5ebf.drv' failed to build

I tried searching in the nixpkgs issue list, and here in discourse, but couldn’t find anything similar. Have anyone else seen this?

Hmm, kind of curious that this triggers a full rebuild of python instead of pulling it from cache. Are you modifying python in some way so that a rebuild is expected? Hydra builds of python38 in 75a5ebf succeeded, which is the revision you tried to upgrade to.

If you don’t want to dig into it too deep, you could try to replace python38 with python312 or another recent version if you’re installing it directly.

Hmm, I’m not entirely sure, but could this be because we have a more up-to-date version of sphinx in nixpkgs than 3.8 requires? Sphinx is specifically pinned to 2.4.4 in cpython 3.8, later versions pin newer sphinx and the line that’s failing in 3.8 is also not present in newer revisions.

Nixpkgs serves sphinx 5.3.0 on unstable and 23.05, but 22.11 still has 5.1.1 on it.

Can you check what version of sphinx is currently installed on your system?

Thanks for responding!

Are you modifying python in some way so that a rebuild is expected?

No, I just have these entries in the list environment.systemPackages (using with pkgs;):

     python38
     python39
     python310
     python311

Can you check what version of sphinx is currently installed on your system?

How do I do this? I don’t seem to have sphinx on my path, at least.

Ah I just noticed, that doc output doesn’t exist. There’s only out and debug. Are you manually specifying it to be installed somewhere?

Here’s some of the output of the nix log command:

$ nix log /nix/store/1nihi2jk6p9rffgfs8bb88rqj7mivchx-python3.8-3.8.17-doc.drv | cat
Sourcing sphinx-hook
@nix { "action": "setPhase", "phase": "unpackPhase" }
unpacking sources
unpacking source archive /nix/store/gx8v4qwd2a24j8pvag9x1bvcpmapxwsh-Python-3.8.17.tar.xz
source root is Python-3.8.17
setting SOURCE_DATE_EPOCH to timestamp 1686059395 of file Python-3.8.17/Misc/NEWS
@nix { "action": "setPhase", "phase": "patchPhase" }
patching sources
@nix { "action": "setPhase", "phase": "installPhase" }
installing
no Makefile or custom installPhase, doing nothing
@nix { "action": "setPhase", "phase": "fixupPhase" }
post-installation fixup
@nix { "action": "setPhase", "phase": "buildSphinxPhase" }
buildSphinxPhase
Executing buildSphinxPhase
Executing sphinx-build with html builder
Running Sphinx v5.3.0
making output directory... done
locale_dir /build/Python-3.8.17/Doc/locales/en/LC_MESSAGES does not exists
locale_dir /build/Python-3.8.17/Doc/locales/en/LC_MESSAGES does not exists
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 480 source files that are out of date
updating environment: locale_dir /build/Python-3.8.17/Doc/locales/en/LC_MESSAGES does not exists
[new config] 480 added, 0 changed, 0 removed
reading sources... [  0%] about
reading sources... [  0%] bugs
reading sources... [  0%] c-api/abstract
reading sources... [  0%] c-api/allocation
reading sources... [  1%] c-api/apiabiversion
reading sources... [  1%] c-api/arg

Traceback (most recent call last):
  File "/nix/store/4097b962ndm1d8ddidn8rzbjg3xfvjvr-python3.10-sphinx-5.3.0/lib/python3.10/site-packages/sphinx/cmd/build.py", line 281, in build_main
    app.build(args.force_all, args.filenames)
  File "/nix/store/4097b962ndm1d8ddidn8rzbjg3xfvjvr-python3.10-sphinx-5.3.0/lib/python3.10/site-packages/sphinx/application.py", line 347, in build
    self.builder.build_update()
  File "/nix/store/4097b962ndm1d8ddidn8rzbjg3xfvjvr-python3.10-sphinx-5.3.0/lib/python3.10/site-packages/sphinx/builders/__init__.py", line 310, in build_update

...

  File "/nix/store/fhraysjy7q3jgb549b0w9j3c3sg91hh2-python3.10-docutils-0.19/lib/python3.10/site-packages/docutils/parsers/rst/states.py", line 2660, in explicit_markup
    nodelist, blank_finish = self.explicit_construct(match)
  File "/nix/store/fhraysjy7q3jgb549b0w9j3c3sg91hh2-python3.10-docutils-0.19/lib/python3.10/site-packages/docutils/parsers/rst/states.py", line 2367, in explicit_construct
    return method(self, expmatch)
  File "/nix/store/fhraysjy7q3jgb549b0w9j3c3sg91hh2-python3.10-docutils-0.19/lib/python3.10/site-packages/docutils/parsers/rst/states.py", line 2104, in directive
    return self.run_directive(
  File "/nix/store/fhraysjy7q3jgb549b0w9j3c3sg91hh2-python3.10-docutils-0.19/lib/python3.10/site-packages/docutils/parsers/rst/states.py", line 2154, in run_directive
    result = directive_instance.run()
  File "/build/Python-3.8.17/Doc/tools/extensions/pyspecific.py", line 360, in run
    label = translators['sphinx'].gettext(label)
KeyError: 'sphinx'

Exception occurred:
  File "/build/Python-3.8.17/Doc/tools/extensions/pyspecific.py", line 360, in run
    label = translators['sphinx'].gettext(label)
KeyError: 'sphinx'
The full traceback has been saved in /build/sphinx-err-3kio852d.log, if you want to report the issue to the developers.
Please also report this if it was a user error, so that a better error message can be provided next time.
A bug report can be filed in the tracker at <https://github.com/sphinx-doc/sphinx/issues>. Thanks!

Ah I just noticed, that doc output doesn’t exist. There’s only out and debug. Are you manually specifying it to be installed somewhere?

I’m sorry but I don’t understand. What does “it” refer to in that question?

Nevermind, the way you install python can’t cause an issue with this.

Ah, as suspected, so nixpkgs is indeed using 5.3.0

And it’s using the one from python 3.10, which is not great.

Just as a quick sanity check: could you remove python38 from that list and try rebuilding again?

1 Like

Removing python38 gives me the same result. I will try other permutations and report back.

  • Removing only python38 has no effect. Error still there.
  • Removing only python39 has no effect. Error still there.
  • Removing only python310 has no effect. Error still there.
  • Removing only python311 has no effect. Error still there.
  • Removing both python38 and python39 makes the error go away.

Ah okay, that’s interesting.

I don’t have a NixOS instance to test on, so I can’t help much with debugging why the rebuild isn’t pulling from cache and why the build fails, but we can just prevent the old python versions from being upgraded in the first place.

To do this, add an additional input to your flake at the previous revision like this:

inputs.old-nixpkgs = {
  type = "github";
  owner = "NixOS";
  repo = "nixpkgs";
  rev = "f294325aed382b66c7a188482101b0f336d1d7db";
};

(make sure to also add old-nixpkgs to the arguments of the outputs function)

And then add python38 and 39 to your systemPackages something like this:

environment.systemPackages = (with pkgs; [
    ...
    python310
    python311
    ...
  ]) ++ (with old-nixpkgs; [
    python38
    python39
  ]);

Maybe also add a comment why you’re doing this so you won’t forget in the future :smiley:

1 Like

Thank you very much! I think this sounds like a good approach, and will also be a nice way to get me python37 and python36 :smile: I tried it now but wasn’t able to get it completely working. I added the flake input and output, so that my flake.nix now looks like this:

{
  description = "dell flake config";

  inputs = {
    nixpkgs = {
      url = "nixpkgs/nixos-unstable";
    };
    # Adding an old nixpkgs to get python38 and python39 working, ref
    # <https://discourse.nixos.org/t/python3-8-sphinx-build-failure-on-unstable/29102/11?u=stianlagstad>
    old-nixpkgs = {
      type = "github";
      owner = "NixOS";
      repo = "nixpkgs";
      rev = "f294325aed382b66c7a188482101b0f336d1d7db";
    };
    home-manager = {
      url = "github:nix-community/home-manager/master";
      inputs = {
        nixpkgs = {
          follows = "nixpkgs";
        };
      };
    };
  };

  outputs = { nixpkgs, home-manager, old-nixpkgs, ... }:
  let
    system = "x86_64-linux";
    pkgs = import nixpkgs {
      inherit system;
      config = { allowUnfree = true; };
    };
    lib = nixpkgs.lib;
  in {
    nixosConfigurations = {
      nixos-dell = lib.nixosSystem {
        inherit system;
        modules = [
          # System config
          ./configuration.nix
          # Make home-manager available in the above configuration.nix:
          home-manager.nixosModules.home-manager
          {
            # use system-level nixpkgs rather than the HM private ones
            # "This saves an extra Nixpkgs evaluation, adds consistency, and removes the dependency on NIX_PATH, which is otherwise used for importing Nixpkgs."
            home-manager.useGlobalPkgs = true;
          }
        ];
      };
    };
  };
}

What I’m confused about is how to make old-nixpkgs propagate into my configuration.nix. I modified configuration.nix like this:


{ config, pkgs, old-nixpkgs, ... }:

{
  imports =
    [ # Include the results of the hardware scan.
      ./hardware-configuration.nix
    ];

...

    #python38
    #python39
    python310
    python311
  ] ++ (with old-nixpkgs; [
    # Adding an old nixpkgs to get python38 and python39 working, ref
    # <https://discourse.nixos.org/t/python3-8-sphinx-build-failure-on-unstable/29102/11?u=stianlagstad>
    python38
    python39
  ]);

...

But after nix flake update and sudo nixos-rebuild switch --flake .#nixos-dell --show-trace I get this error:

...

       error: attribute 'old-nixpkgs' missing

       at /nix/store/3lv5x5bn3bvy0xmd35ds3dsmvk23591w-source/lib/modules.nix:512:28:

          511|         builtins.addErrorContext (context name)
          512|           (args.${name} or config._module.args.${name})
             |                            ^
          513|       ) (lib.functionArgs f);

I’m guessing that I need to get old-pkgs from flake.nix passed into configuration.nix somehow. How can I do that?

1 Like

According to the NixOS Wiki, it seems like specialArgs will accomplish that:

...
      nixos-dell = lib.nixosSystem {
        inherit system;
        specialArgs = { inherit old-nixpkgs; };
        modules = [
          # System config
          ./configuration.nix
...

btw, if you prefer using the shorter FlakeRef in URL format, you can also refer to old revs like this:

    old-nixpkgs = {
      url = "github:NixOS/nixpkgs/f294325aed382b66c7a188482101b0f336d1d7db";
    };

This is essentially the same thing as before and the exact string that was printed by nix flake update when it told you what rev it was upgrading from.

1 Like

3.8 is EOL and we don’t test it anymore.

Thank you both!

Now, with specialArgs, I’m able to build without the attribute 'old-nixpkgs' missing error, but now I’m back to this again:

error: builder for '/nix/store/1nihi2jk6p9rffgfs8bb88rqj7mivchx-python3.8-3.8.17-doc.drv' failed with exit code 2;
       last 10 log lines:
       >     label = translators['sphinx'].gettext(label)
       > KeyError: 'sphinx'
       >
       > Exception occurred:
       >   File "/build/Python-3.8.17/Doc/tools/extensions/pyspecific.py", line 360, in run
       >     label = translators['sphinx'].gettext(label)
       > KeyError: 'sphinx'
       > The full traceback has been saved in /build/sphinx-err-xl0bizld.log, if you want to report the issue to the developers.
       > Please also report this if it was a user error, so that a better error message can be provided next time.
       > A bug report can be filed in the tracker at <https://github.com/sphinx-doc/sphinx/issues>. Thanks!
       For full logs, run 'nix log /nix/store/1nihi2jk6p9rffgfs8bb88rqj7mivchx-python3.8-3.8.17-doc.drv'.
error: 1 dependencies of derivation '/nix/store/cxrrcinpqbd9icn5myn2846s20dfsn5b-system-path.drv' failed to build
error: 1 dependencies of derivation '/nix/store/1llbr0gis1mazpmdfj2f2d1q7fcgs00g-nixos-system-nixos-dell-23.11.20230611.75a5ebf.drv' failed to build

I didn’t expect this, given that I’m now getting python38 and python39 from old-nixpkgs which points to the previous point in time (github:NixOS/nixpkgs/f294325aed382b66c7a188482101b0f336d1d7db) where they both worked.

Even if I put all those python versions in like this:

  ] ++ (with old-nixpkgs; [
    # Adding an old nixpkgs to get python38 and python39 working, ref
    # <https://discourse.nixos.org/t/python3-8-sphinx-build-failure-on-unstable/29102/11?u=stianlagstad>
    python38
    python39
    python310
    python311
  ]);

so that they all should be retrieved as before, I get the same error.

  • Could it have to do with the fact that my home-manager input is updated?
  • Is it possible for me to trace the build failure of /nix/store/1nihi2jk6p9rffgfs8bb88rqj7mivchx-python3.8-3.8.17-doc.drv and see what’s depending on that?

Oh wow, that’s strange.

Hmm, maybe

nix why-depends /nix/store/1llbr0gis1mazpmdfj2f2d1q7fcgs00g-nixos-system-nixos-dell-23.11.20230611.75a5ebf.drv /nix/store/1nihi2jk6p9rffgfs8bb88rqj7mivchx-python3.8-3.8.17-doc.drv

might be insightful in that regard? You can also run

nix log /nix/store/1nihi2jk6p9rffgfs8bb88rqj7mivchx-python3.8-3.8.17-doc.drv

As suggested by the error to get a more complete picture of what was actually going on before this failure.

Potentially, you also want to check what that derivation actually depends on using

nix derivation show /nix/store/1nihi2jk6p9rffgfs8bb88rqj7mivchx-python3.8-3.8.17-doc.drv

There you can see all the inputs, and maybe that illuminates how 3.8 is built with an incorrect version of sphinx.

That seems very unlikely to me. As home-manager is not an input to ./configuration.nix, it should be impossible for it to influence it. I guess in theory nixosSystem might do some stuff under the hood that creates an interdependence, but that also seems unlikely.

1 Like
$ nix why-depends /nix/store/1llbr0gis1mazpmdfj2f2d1q7fcgs00g-nixos-system-nixos-dell-23.11.20230611.75a5ebf.drv /nix/store/1nihi2jk6p9rffgfs8bb88rqj7mivchx-python3.8-3.8.17-doc.drv | cat

warning: The interpretation of store paths arguments ending in `.drv` recently changed. If this command is now failing try again with '/nix/store/1llbr0gis1mazpmdfj2f2d1q7fcgs00g-nixos-system-nixos-dell-23.11.20230611.75a5ebf.drv^*'
warning: The interpretation of store paths arguments ending in `.drv` recently changed. If this command is now failing try again with '/nix/store/1nihi2jk6p9rffgfs8bb88rqj7mivchx-python3.8-3.8.17-doc.drv^*'
/nix/store/1llbr0gis1mazpmdfj2f2d1q7fcgs00g-nixos-system-nixos-dell-23.11.20230611.75a5ebf.drv
└───/nix/store/cxrrcinpqbd9icn5myn2846s20dfsn5b-system-path.drv
    └───/nix/store/1nihi2jk6p9rffgfs8bb88rqj7mivchx-python3.8-3.8.17-doc.drv
$ nix derivation show /nix/store/1nihi2jk6p9rffgfs8bb88rqj7mivchx-python3.8-3.8.17-doc.drv | cat
warning: The interpretation of store paths arguments ending in `.drv` recently changed. If this command is now failing try again with '/nix/store/1nihi2jk6p9rffgfs8bb88rqj7mivchx-python3.8-3.8.17-doc.drv^*'
{
  "/nix/store/1nihi2jk6p9rffgfs8bb88rqj7mivchx-python3.8-3.8.17-doc.drv": {
    "args": [
      "-e",
      "/nix/store/6xg259477c90a229xwmb53pdfkn6ig3g-default-builder.sh"
    ],
    "builder": "/nix/store/xfb3ykw9r5hpayd05sr0cizwadzq1d8q-bash-5.2-p15/bin/bash",
    "env": {
      "__structuredAttrs": "",
      "buildInputs": "",
      "builder": "/nix/store/xfb3ykw9r5hpayd05sr0cizwadzq1d8q-bash-5.2-p15/bin/bash",
      "cmakeFlags": "",
      "configureFlags": "",
      "depsBuildBuild": "",
      "depsBuildBuildPropagated": "",
      "depsBuildTarget": "",
      "depsBuildTargetPropagated": "",
      "depsHostHost": "",
      "depsHostHostPropagated": "",
      "depsTargetTarget": "",
      "depsTargetTargetPropagated": "",
      "doCheck": "",
      "doInstallCheck": "",
      "dontBuild": "1",
      "dontConfigure": "1",
      "mesonFlags": "",
      "name": "python3.8-3.8.17-doc",
      "nativeBuildInputs": "/nix/store/65jbjk2kq486ikqpqwiycav5h4bnlk3p-python3.10-sphinx-hook /nix/store/j761qnsqsz4rn7gmnwfkm89b80r7gblm-python3.10-python_docs_theme-2023.3.1",
      "out": "/nix/store/vsx79qihpd623hnwpgpr0dlb7c610zgc-python3.8-3.8.17-doc",
      "outputs": "out",
      "patches": "",
      "postInstallSphinx": "mv $out/share/doc/* $out/share/doc/python3.8-3.8.17\n",
      "propagatedBuildInputs": "",
      "propagatedNativeBuildInputs": "",
      "sphinxRoot": "Doc",
      "src": "/nix/store/gx8v4qwd2a24j8pvag9x1bvcpmapxwsh-Python-3.8.17.tar.xz",
      "stdenv": "/nix/store/74l4x6m97bvry7ccxv51h952ayvg2j46-stdenv-linux",
      "strictDeps": "",
      "system": "x86_64-linux"
    },
    "inputDrvs": {
      "/nix/store/5lz9p8xhf89kb1c1kk6jxrzskaiygnlh-bash-5.2-p15.drv": [
        "out"
      ],
      "/nix/store/8cabgxbqgzwj5wf48gkpqnagl6mid2xc-python3.10-sphinx-hook.drv": [
        "out"
      ],
      "/nix/store/sh7443lbc9srcha501dgphjdk2b6dslb-Python-3.8.17.tar.xz.drv": [
        "out"
      ],
      "/nix/store/vvj5a1j1i1avp1ibm8gdcz2jz5gkkkvq-stdenv-linux.drv": [
        "out"
      ],
      "/nix/store/wqmfwn6gfyqvy2qjmhqqlkmrpkmvhvjc-python3.10-python_docs_theme-2023.3.1.drv": [
        "out"
      ]
    },
    "inputSrcs": [
      "/nix/store/6xg259477c90a229xwmb53pdfkn6ig3g-default-builder.sh"
    ],
    "name": "python3.8-3.8.17-doc",
    "outputs": {
      "out": {
        "path": "/nix/store/vsx79qihpd623hnwpgpr0dlb7c610zgc-python3.8-3.8.17-doc"
      }
    },
    "system": "x86_64-linux"
  }
}

Are the inputs there weird?

    "inputDrvs": {
      "/nix/store/5lz9p8xhf89kb1c1kk6jxrzskaiygnlh-bash-5.2-p15.drv": [
        "out"
      ],
      "/nix/store/8cabgxbqgzwj5wf48gkpqnagl6mid2xc-python3.10-sphinx-hook.drv": [
        "out"
      ],
      "/nix/store/sh7443lbc9srcha501dgphjdk2b6dslb-Python-3.8.17.tar.xz.drv": [
        "out"
      ],
      "/nix/store/vvj5a1j1i1avp1ibm8gdcz2jz5gkkkvq-stdenv-linux.drv": [
        "out"
      ],
      "/nix/store/wqmfwn6gfyqvy2qjmhqqlkmrpkmvhvjc-python3.10-python_docs_theme-2023.3.1.drv": [
        "out"
      ]
    },

in that there’s both Python-3.8.17 and python3.10-sphinx-hook?

Ha, yeah exactly. That’s very strange, somehow the mere presence of python310 causes python38 to use a different hook. Hm, actually, could you check the inputs of the derivation of your successful python38 installation? You can find it if you know the store path with

nix path-info --derivation <store-path>

Actually, as we know the exact revision, I assume

nix path-info --derivation 'github:NixOS/nixpkgs/f294325aed382b66c7a188482101b0f336d1d7db#python38'

should work. And I assume its derivation inputs contain a python3.8-sphinx-hook.

It’s the exact same issue we saw before. I guess we’ll have to dig into the code to find the exact issue, but I’m not at a device where I can easily browse that right now.

1 Like

Thanks again!

$ nix path-info --derivation github:NixOS/nixpkgs/f294325aed382b66c7a188482101b0f336d1d7db#python38

/nix/store/5ll8lnqq9fnsm8ys1hxi57aglwxbaml1-python3-3.8.16.drv

That one is a bit bigger:

$ nix derivation show /nix/store/5ll8lnqq9fnsm8ys1hxi57aglwxbaml1-python3-3.8.16.drv
warning: The interpretation of store paths arguments ending in `.drv` recently changed. If this command is now failing try again with '/nix/store/5ll8lnqq9fnsm8ys1hxi57aglwxbaml1-python3-3.8.16.drv^*'
{
  "/nix/store/5ll8lnqq9fnsm8ys1hxi57aglwxbaml1-python3-3.8.16.drv": {
    "args": [
      "-e",
      "/nix/store/6xg259477c90a229xwmb53pdfkn6ig3g-default-builder.sh"
    ],
    "builder": "/nix/store/zlf0f88vj30sc7567b80l52d19pbdmy2-bash-5.2-p15/bin/bash",
    "env": {
      "CPPFLAGS": "-I/nix/store/lf6arf2qj94qs6bkzfl2y75chb7awmx9-zlib-1.2.13-dev/include -I/nix/store/n0hk7kbmiy9glz7jvx6zycfbbcdq735n-bzip2-1.0.8-dev/include -I/nix/store/ikvk5h1wy3sc3vaf4ccych0xrkhp6w1p-expat-2.5.0-dev/include -I/nix/store/b76imzrhblhnaardsvcg0id3arykczlk-xz-5.4.2-dev/include -I/nix/store/5nl887dh4mi80dm1m243bzxng81glc8i-libffi-3.4.4-dev/include -I/nix/store/wy0incigsdz3nai26lxmn9ibchnb0qd6-libxcrypt-4.4.33/include -I/nix/store/4n9sflsa28gjiz7m858rzky6g9vaq0xr-gdbm-1.23/include -I/nix/store/cvbww4niqc0az7gjmf2x5jdrf03mij6y-sqlite-3.41.2-dev/include -I/nix/store/vpw3zn8idfajnlmk909da34lbvdfqdjv-readline-8.2p1-dev/include -I/nix/store/wj13qyzpxq60ayh4msj00x8qi2m94777-ncurses-6.4-dev/include -I/nix/store/4168nnz1a4l5ic8gaf4h073274p0vwq3-openssl-3.0.8-dev/include",
      "LDFLAGS": "-L/nix/store/2ldgh1qis9p4zf8bgsdm7897gw8vv36g-zlib-1.2.13/lib -L/nix/store/by4gv37sharnf370ki60zam5s7qklqqh-bzip2-1.0.8/lib -L/nix/store/si8ypl8afi2s301wwxrrcvirz05x022r-expat-2.5.0/lib -L/nix/store/5533i5qzsxysjf38p1nlza9g9wvh09wk-xz-5.4.2/lib -L/nix/store/zi3wndir89vvbly8fkdwvq9v17vrpw8h-libffi-3.4.4/lib -L/nix/store/wy0incigsdz3nai26lxmn9ibchnb0qd6-libxcrypt-4.4.33/lib -L/nix/store/4n9sflsa28gjiz7m858rzky6g9vaq0xr-gdbm-1.23/lib -L/nix/store/0ssb3rn06pqn5qjms1ma9qcp10n2jjny-sqlite-3.41.2/lib -L/nix/store/s8axd2sknp45d2jmxkasmq8zxd1mv068-readline-8.2p1/lib -L/nix/store/q5mhssfls6iych80439511vz7539gd95-ncurses-6.4/lib -L/nix/store/40b7dx08rz3ypcvjyrd860dw8g3j518m-openssl-3.0.8/lib",
      "LIBS": "-lcrypt",
      "NIX_LDFLAGS": "-lgcc_s",
      "PYTHONHASHSEED": "0",
      "__structuredAttrs": "",
      "buildInputs": "/nix/store/g61d598p36nr2i43mdhyvx2ylrrdf08c-bash-5.2-p15-dev /nix/store/lf6arf2qj94qs6bkzfl2y75chb7awmx9-zlib-1.2.13-dev /nix/store/n0hk7kbmiy9glz7jvx6zycfbbcdq735n-bzip2-1.0.8-dev /nix/store/ikvk5h1wy3sc3vaf4ccych0xrkhp6w1p-expat-2.5.0-dev /nix/store/b76imzrhblhnaardsvcg0id3arykczlk-xz-5.4.2-dev /nix/store/5nl887dh4mi80dm1m243bzxng81glc8i-libffi-3.4.4-dev /nix/store/wy0incigsdz3nai26lxmn9ibchnb0qd6-libxcrypt-4.4.33 /nix/store/4n9sflsa28gjiz7m858rzky6g9vaq0xr-gdbm-1.23 /nix/store/cvbww4niqc0az7gjmf2x5jdrf03mij6y-sqlite-3.41.2-dev /nix/store/vpw3zn8idfajnlmk909da34lbvdfqdjv-readline-8.2p1-dev /nix/store/wj13qyzpxq60ayh4msj00x8qi2m94777-ncurses-6.4-dev /nix/store/4168nnz1a4l5ic8gaf4h073274p0vwq3-openssl-3.0.8-dev",
      "builder": "/nix/store/zlf0f88vj30sc7567b80l52d19pbdmy2-bash-5.2-p15/bin/bash",
      "cmakeFlags": "",
      "configureFlags": "--without-ensurepip --with-system-expat --with-system-ffi --enable-shared --with-lto --enable-loadable-sqlite-extensions --with-openssl=/nix/store/4168nnz1a4l5ic8gaf4h073274p0vwq3-openssl-3.0.8-dev CFLAGS=-I/nix/store/wy0incigsdz3nai26lxmn9ibchnb0qd6-libxcrypt-4.4.33/include LIBS=-L/nix/store/wy0incigsdz3nai26lxmn9ibchnb0qd6-libxcrypt-4.4.33/lib ac_cv_func_lchmod=no",
      "debug": "/nix/store/679l7jrx19366l738wa6nf9fgi2503hw-python3-3.8.16-debug",
      "depsBuildBuild": "",
      "depsBuildBuildPropagated": "",
      "depsBuildTarget": "",
      "depsBuildTargetPropagated": "",
      "depsHostHost": "",
      "depsHostHostPropagated": "",
      "depsTargetTarget": "",
      "depsTargetTargetPropagated": "",
      "disallowedReferences": "/nix/store/4168nnz1a4l5ic8gaf4h073274p0vwq3-openssl-3.0.8-dev",
      "doCheck": "",
      "doInstallCheck": "",
      "enableParallelBuilding": "1",
      "enableParallelChecking": "1",
      "enableParallelInstalling": "1",
      "mesonFlags": "",
      "name": "python3-3.8.16",
      "nativeBuildInputs": "/nix/store/dn7hlwfmv3z394s86pvfpj2444x3bvjk-autoreconf-hook /nix/store/liawqp5fjqna6gnrpp8rs3x1gfb5fxjj-pkg-config-wrapper-0.29.2 /nix/store/p17jl9j9iwg9750f5da3q1bf813whrhb-autoconf-archive-2022.09.03 /nix/store/5izwq1i5q8bwacip6ipnkmqh34p67ysv-nuke-references /nix/store/adgdkjgx1n2r7a8mjgp4jz7g48na9pq0-separate-debug-info.sh",
      "out": "/nix/store/y9niqy128f5zdspsi9bvrgw7lbw7k4yi-python3-3.8.16",
      "outputs": "out debug",
      "patches": "/nix/store/p4qar37zn2892m83b2lkp8fw5dsjkzxy-no-ldconfig.patch /nix/store/r112dk8w7zvdjipki58ch00m825li7fq-virtualenv-permissions.patch /nix/store/lpfs02z2i2hamz9f50p4bz6v0fs0600j-mimetypes.patch /nix/store/dkb2rjyj7lwmvsn4zzwx85kx8r61nk9w-darwin-libutil.patch /nix/store/cv1ynpzvjjr0s72jkbblbzz3ymr87lpi-0001-On-all-posix-systems-not-just-Darwin-set-LDSHARED-if.patch /nix/store/57kclla9vza2n87xgwg1ap54d20cz6lb-fix-finding-headers-when-cross-compiling.patch",
      "pname": "python3",
      "postFixup": "cat << \"EOF\" >> \"$out/nix-support/setup-hook\"\nsysconfigdataHook() {\n  if [ \"$1\" = '/1rz4g4znpzjwh1xymhjpm42vipw92pr73vdgl6xs1hycac8kf2n9' ]; then\n    export _PYTHON_HOST_PLATFORM='linux-x86_64'\n    export _PYTHON_SYSCONFIGDATA_NAME='_sysconfigdata__linux_x86_64-linux-gnu'\n  fi\n}\n\naddEnvHooks \"$hostOffset\" sysconfigdataHook\n\nEOF\n",
      "postInstall": "# needed for some packages, especially packages that backport functionality\n# to 2.x from 3.x\nfor item in $out/lib/python3.8/test/*; do\n  if [[ \"$item\" != */test_support.py*\n     && \"$item\" != */test/support\n     && \"$item\" != */test/libregrtest\n     && \"$item\" != */test/regrtest.py* ]]; then\n    rm -rf \"$item\"\n  else\n    echo $item\n  fi\ndone\ntouch $out/lib/python3.8/test/__init__.py\n\nln -s \"$out/include/python3.8m\" \"$out/include/python3.8\"\n\n# Determinism: Windows installers were not deterministic.\n# We're also not interested in building Windows installers.\nfind \"$out\" -name 'wininst*.exe' | xargs -r rm -f\n\n# Use Python3 as default python\nln -s \"$out/bin/idle3\" \"$out/bin/idle\"\nln -s \"$out/bin/pydoc3\" \"$out/bin/pydoc\"\nln -s \"$out/bin/python3\" \"$out/bin/python\"\nln -s \"$out/bin/python3-config\" \"$out/bin/python-config\"\nln -s \"$out/lib/pkgconfig/python3.pc\" \"$out/lib/pkgconfig/python.pc\"\n\n# Get rid of retained dependencies on -dev packages, and remove\n# some $TMPDIR references to improve binary reproducibility.\n# Note that the .pyc file of _sysconfigdata.py should be regenerated!\nfor i in $out/lib/python3.8/_sysconfigdata*.py $out/lib/python3.8/config-38*/Makefile; do\n   sed -i $i -e \"s|$TMPDIR|/no-such-path|g\"\ndone\n\n# Further get rid of references. https://github.com/NixOS/nixpkgs/issues/51668\nfind $out/lib/python*/config-* -type f -print -exec nuke-refs -e /1rz4g4znpzjwh1xymhjpm42vipw92pr73vdgl6xs1hycac8kf2n9 -e /nix/store/wy0incigsdz3nai26lxmn9ibchnb0qd6-libxcrypt-4.4.33 '{}' +\nfind $out/lib -name '_sysconfigdata*.py*' -print -exec nuke-refs -e /1rz4g4znpzjwh1xymhjpm42vipw92pr73vdgl6xs1hycac8kf2n9 -e /nix/store/wy0incigsdz3nai26lxmn9ibchnb0qd6-libxcrypt-4.4.33 '{}' +\n\n# Make the sysconfigdata module accessible on PYTHONPATH\n# This allows build Python to import host Python's sysconfigdata\nmkdir -p \"$out/lib/python3.8/site-packages\"\nln -s \"$out/lib/python3.8/\"_sysconfigdata*.py \"$out/lib/python3.8/site-packages/\"\n# Include a sitecustomize.py file\ncp /nix/store/kclys2xfrg0zjmpa37gyp33nyg1c7j0q-sitecustomize.py $out/lib/python3.8/site-packages/sitecustomize.py\n\n# Determinism: deterministic bytecode\n# First we delete all old bytecode.\nfind $out -type d -name __pycache__ -print0 | xargs -0 -I {} rm -rf \"{}\"\n# Python 3.7 implements PEP 552, introducing support for deterministic bytecode.\n# compileall uses the therein introduced checked-hash method by default when\n# `SOURCE_DATE_EPOCH` is set.\n# We exclude lib2to3 because that's Python 2 code which fails\n# We build 3 levels of optimized bytecode. Note the default level, without optimizations,\n# is not reproducible yet. https://bugs.python.org/issue29708\n# Not creating bytecode will result in a large performance loss however, so we do build it.\nfind $out -name \"*.py\" | $out/bin/python -m compileall -q -f -x \"lib2to3\" -i -\nfind $out -name \"*.py\" | $out/bin/python -O  -m compileall -q -f -x \"lib2to3\" -i -\nfind $out -name \"*.py\" | $out/bin/python -OO -m compileall -q -f -x \"lib2to3\" -i -\n# *strip* shebang from libpython gdb script - it should be dual-syntax and\n# interpretable by whatever python the gdb in question is using, which may\n# not even match the major version of this python. doing this after the\n# bytecode compilations for the same reason - we don't want bytecode generated.\nmkdir -p $out/share/gdb\nsed '/^#!/d' Tools/gdb/libpython.py > $out/share/gdb/libpython.py\n",
      "postPatch": "substituteInPlace Lib/subprocess.py \\\n  --replace \"'/bin/sh'\" \"'/nix/store/zlf0f88vj30sc7567b80l52d19pbdmy2-bash-5.2-p15/bin/sh'\"\nsubstituteInPlace Lib/mimetypes.py \\\n  --replace \"@mime-types@\" \"/nix/store/x178gr6fnfcm1s53vbksi6wd3awqdh8h-mailcap-2.1.53\"\n",
      "preConfigure": "for i in /usr /sw /opt /pkg; do\t# improve purity\n  substituteInPlace ./setup.py --replace $i /no-such-path\ndone\nexport CFLAGS_NODIST=\"-fno-semantic-interposition\"\n",
      "preFixup": "",
      "prePatch": "",
      "propagatedBuildInputs": "",
      "propagatedNativeBuildInputs": "",
      "separateDebugInfo": "1",
      "setupHook": "/nix/store/19xcg9vnkkr9hwd8iklbfyx8hp7j7xn5-python-setup-hook.sh",
      "src": "/nix/store/scfxsjypkhlahmnac2d1c898v3ddrlpb-Python-3.8.16.tar.xz",
      "stdenv": "/nix/store/5s1yg5l36wzgy1dj0vv1ibarc4g7vrdr-stdenv-linux",
      "strictDeps": "",
      "system": "x86_64-linux",
      "version": "3.8.16"
    },
    "inputDrvs": {
      "/nix/store/2alni3s6zjs6ipzbafqdbdgm1zkaxfhd-autoreconf-hook.drv": [
        "out"
      ],
      "/nix/store/5l92g2q5ymaii3pz7s36y88madg6rs54-pkg-config-wrapper-0.29.2.drv": [
        "out"
      ],
      "/nix/store/5nibgkfqc6gain0hzr491djksg3kwf8z-libffi-3.4.4.drv": [
        "dev",
        "out"
      ],
      "/nix/store/758czggsn7xdx6wm1fh15zr64cd239jp-bzip2-1.0.8.drv": [
        "dev",
        "out"
      ],
      "/nix/store/7jcqqqsd2ma84l46wzgd4pxbrkrz91jc-openssl-3.0.8.drv": [
        "dev",
        "out"
      ],
      "/nix/store/90a4zrl8f3479v69vb273m566gaiyfyc-autoconf-archive-2022.09.03.drv": [
        "out"
      ],
      "/nix/store/9bn3xnnyrpar63309s1bqq9480gf4d99-ncurses-6.4.drv": [
        "dev",
        "out"
      ],
      "/nix/store/afgczn0y3yxpkqyhwg7al9q4gfqx7a99-readline-8.2p1.drv": [
        "dev",
        "out"
      ],
      "/nix/store/anbnl4ws68801p53c0k3nhmsqkfb2m4b-sqlite-3.41.2.drv": [
        "dev",
        "out"
      ],
      "/nix/store/b54w2jbb3ywk2rbf06c8qk3q6irnzr9j-expat-2.5.0.drv": [
        "dev",
        "out"
      ],
      "/nix/store/fx363827fjqpcmb4zaikvni371mg26wb-nuke-references.drv": [
        "out"
      ],
      "/nix/store/i8srfn1mlsc88ki6yfv8vvs5yg00n76z-python-setup-hook.sh.drv": [
        "out"
      ],
      "/nix/store/lk7ib890n5yxrf3pnccf63bg0bp2i922-Python-3.8.16.tar.xz.drv": [
        "out"
      ],
      "/nix/store/m1yql6a0w06r5fiq0g6p32nm4wvllfwj-libxcrypt-4.4.33.drv": [
        "out"
      ],
      "/nix/store/pjl6y0k7vbi72y9rkn0bpcxwfws549m8-mailcap-2.1.53.drv": [
        "out"
      ],
      "/nix/store/q0ml0xhn7vlranc9h2gh7kwy357jmr4h-bash-5.2-p15.drv": [
        "dev",
        "out"
      ],
      "/nix/store/w184rg11rf6ridzdxhq6w9jm70706wf0-stdenv-linux.drv": [
        "out"
      ],
      "/nix/store/w7nn0bz0hfd1g09pys1pkhilyvk2wzrh-xz-5.4.2.drv": [
        "dev",
        "out"
      ],
      "/nix/store/whrmqngan2zssd4cw9pfzrw686v13cc9-zlib-1.2.13.drv": [
        "dev",
        "out"
      ],
      "/nix/store/z127pqfpa38y94x6j0hmnmbkww4vafa3-gdbm-1.23.drv": [
        "out"
      ]
    },
    "inputSrcs": [
      "/nix/store/57kclla9vza2n87xgwg1ap54d20cz6lb-fix-finding-headers-when-cross-compiling.patch",
      "/nix/store/6xg259477c90a229xwmb53pdfkn6ig3g-default-builder.sh",
      "/nix/store/adgdkjgx1n2r7a8mjgp4jz7g48na9pq0-separate-debug-info.sh",
      "/nix/store/cv1ynpzvjjr0s72jkbblbzz3ymr87lpi-0001-On-all-posix-systems-not-just-Darwin-set-LDSHARED-if.patch",
      "/nix/store/dkb2rjyj7lwmvsn4zzwx85kx8r61nk9w-darwin-libutil.patch",
      "/nix/store/kclys2xfrg0zjmpa37gyp33nyg1c7j0q-sitecustomize.py",
      "/nix/store/lpfs02z2i2hamz9f50p4bz6v0fs0600j-mimetypes.patch",
      "/nix/store/p4qar37zn2892m83b2lkp8fw5dsjkzxy-no-ldconfig.patch",
      "/nix/store/r112dk8w7zvdjipki58ch00m825li7fq-virtualenv-permissions.patch"
    ],
    "name": "python3-3.8.16",
    "outputs": {
      "debug": {
        "path": "/nix/store/679l7jrx19366l738wa6nf9fgi2503hw-python3-3.8.16-debug"
      },
      "out": {
        "path": "/nix/store/y9niqy128f5zdspsi9bvrgw7lbw7k4yi-python3-3.8.16"
      }
    },
    "system": "x86_64-linux"
  }
}

Are these:

      "/nix/store/i8srfn1mlsc88ki6yfv8vvs5yg00n76z-python-setup-hook.sh.drv": [
        "out"
      ],
      "/nix/store/lk7ib890n5yxrf3pnccf63bg0bp2i922-Python-3.8.16.tar.xz.drv": [
        "out"
      ],

the equivalent in this version, perhaps?

1 Like

That is why with expression is discouraged by many people. You are probably getting python38 from with pkgs you have in the outer scope. Notice that the reply that suggested this correctly wrapped the with pkgs scope in parentheses:

Either add the parentheses, or just use old-nixpkgs.python38 directly.

Also, if you are passing old-nixpkgs from inputs directly to specialArgs as suggested in Python3.8 sphinx build failure on unstable - #13 by iFreilicht, you are passing the whole flake, so you would have to use something like old-nixpkgs.legacyPackages.x86_64-linux.python38 in the configuration.

Or just pass only the old package set:

specialArgs = {
  old-nixpkgs = old-nixpkgs.legacyPackages.${system};
};
2 Likes