Skip to content

fix(action): pyproject-gated CPython PATH exclusion breaks Python consumers on NixOS self-hosted runners #1360

Closed

Description

@c-vigo

Problem

Split out of #1358 (found during the #1353 audit). The direnv-mode setup-devkit-toolchain PATH filter (#1028) removes the bare Nix CPython from the exported dev-shell PATH whenever pyproject.toml is present — unconditionally. On a hosted (FHS) runner that is correct: uv downloads a managed manylinux CPython. On a NixOS self-hosted runner it is wrong by design: after #1353 (UV_PYTHON no longer forwarded), uv downloads a managed CPython that NixOS cannot execute, so uv sync fails. Before #1353 the forwarded UV_PYTHON pin masked the gap.

No current consumer matches the combination (the only NixOS self-hosted runner consumer has no pyproject.toml), so nothing is broken today — this is a landmine for the first Python consumer that targets a NixOS runner.

Expected

Make the exclusion NixOS-aware: keep the Nix CPython on PATH (and skip the managed-download path, e.g. keep/restore the uv pins) when the runner is NixOS — [ -e /etc/NIXOS ] is the established probe (mkProjectShell's own shellHook uses it for LD_LIBRARY_PATH).

Refs: #1358, #1353, #1028

Activity

  1. added
    bug
    on Aug 7, 2026
  2. added this to the 1.6.1 milestone on Aug 7, 2026
  3. added
    area:ci
    effort:medium
    semver:patch
    priority:medium
    on Aug 7, 2026
  4. c-vigo commented on Aug 7, 2026

    @c-vigo
    ContributorAuthor

    Fixed on dev by PR #1363: the step probes the runner host once (/etc/NIXOS; DEVKIT_NIXOS_MARKER overrides it for the test harness only) and on NixOS keeps the Nix CPython on PATH AND lets the UV_PYTHON/UV_PYTHON_DOWNLOADS pins forward — both halves needed, since uv's python-preference could otherwise still pick an unrunnable managed download. FHS runners are byte-identical to before, now pinned by a regression-bar test (the #1028 exclusion previously had no coverage). Ships with 1.6.1.

  5. gerchowl commented on Dec 1, 2026

    @gerchowl
    Contributor

    Downstream evidence from MorePET/dogplet-histo#25: the same exclusion also removes a project's explicitly provisioned Nix python3-<version>-env withPackages environment on a non-NixOS runner. The existing NixOS guard does not address that case.

    In run 46511231229, setup-devkit-toolchain reported Runner is NixOS: false. With a pyproject.toml present, its *-python3-<version>*/bin PATH filter removed the project interpreter before exporting GITHUB_PATH. The subsequent host-Bash just sync failed because no ambient python remained. This project intentionally uses Nix dependencies in both local development and CI, rather than uv/manylinux Python.

    Current downstream workaround: a named dogplet-python wrapper selects the absolute withPackages interpreter and library closure, so its bin path survives the export filter. It also removes Nix-store PYTHONPATH entries that can inject the devkit interpreter's different Python ABI; explicit project paths such as src remain. An integration test reproduces the filtered PATH in non-login Bash and checks dependency imports. Runtime dependencies remain declared in pyproject.toml, with versions pinned by Nix.

    Please preserve explicitly supplied project withPackages interpreters, or provide an explicit Nix-only Python export mode, in addition to the existing NixOS detection. Diagnosis and workaround: https://github.com/MorePET/dogplet-histo/blob/main/schemas/README.md#ci-python-environment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:cibugeffort:mediumpriority:mediumsemver:patch

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions