Skip to content

prek: Declare runtime dependencies#500949

Open
l0b0 wants to merge 1 commit intoNixOS:masterfrom
l0b0:bundle_uv_with_prek
Open

prek: Declare runtime dependencies#500949
l0b0 wants to merge 1 commit intoNixOS:masterfrom
l0b0:bundle_uv_with_prek

Conversation

@l0b0
Copy link
Copy Markdown
Contributor

@l0b0 l0b0 commented Mar 18, 2026

prek assumes that git is on the PATH.

prek will attempt to download uv if it's not on the PATH, but the
downloaded executable is not compatible with NixOS. prek also assumes
python is on the PATH when dealing with Python-based hooks. Because
of this I've bundled those under a withPythonSupport flag. This flag
defaults to false for compatibility with the original code, and to
keep the package the minimal size by default.

Closes j178/prek#1707.

Things done

  • Built on platform:
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • Tested, as applicable:
  • Ran nixpkgs-review on this PR. See nixpkgs-review usage.
  • Tested basic functionality of all binary files, usually in ./result/bin/.
  • Nixpkgs Release Notes
    • Package update: when the change is major or breaking.
  • NixOS Release Notes
    • Module addition: when adding a new NixOS module.
    • Module update: when the change is significant.
  • Fits CONTRIBUTING.md, pkgs/README.md, maintainers/README.md and other READMEs.

@l0b0 l0b0 force-pushed the bundle_uv_with_prek branch from c6b1b57 to 27ecd70 Compare March 18, 2026 07:37
@l0b0 l0b0 requested a review from knl March 18, 2026 07:37
@l0b0 l0b0 force-pushed the bundle_uv_with_prek branch from 27ecd70 to 8bfea02 Compare March 18, 2026 07:38
@nixpkgs-ci nixpkgs-ci bot added 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. labels Mar 18, 2026
@j178
Copy link
Copy Markdown

j178 commented Mar 18, 2026

prek assumes that python are on the PATH

No, prek only needs Python and uv if you’re using Python hooks, so I don’t think they should be listed as runtime dependencies.

@l0b0
Copy link
Copy Markdown
Contributor Author

l0b0 commented Mar 18, 2026

prek assumes that python are on the PATH

No, prek only needs Python and uv if you’re using Python hooks, so I don’t think they should be listed as runtime dependencies.

uv, at least, has to be a dependency, because a lot of projects don't install or use uv, and the uv installed by prek doesn't run on NixOS.

Using Python hooks doesn't necessarily mean that the project itself is Python-based, so we can't assume that Python is installed on the system either.

(Yes, this probably means we'll have to install a bunch of tools as runtime dependencies for prek to work with all hook types out of the box. That's not really a problem, AFAIK.)

Update: We could add flags to the prek package to allow users to exclude dependencies they don't need. Something like withPythonDependencies etc, and/or a global withAllDependencies to get a minimal/full install.`

@lafrenierejm
Copy link
Copy Markdown
Contributor

Update: We could add flags to the prek package to allow users to exclude dependencies they don't need. Something like withPythonDependencies etc, and/or a global withAllDependencies to get a minimal/full install.`

This approach of predefined, optional dependency groups is the cleanest IMO. It provides a good balance between package size and end-user customization. Additionally, the pattern is already common throughout nixpkgs so it should be familiar to any future contributors.

@nixpkgs-ci nixpkgs-ci bot added 12.approvals: 1 This PR was reviewed and approved by one person. 12.approved-by: package-maintainer This PR was reviewed and approved by a maintainer listed in any of the changed packages. labels Mar 22, 2026
@l0b0 l0b0 force-pushed the bundle_uv_with_prek branch from 8bfea02 to 3313f7a Compare March 26, 2026 09:07
@l0b0 l0b0 requested a review from lafrenierejm March 26, 2026 09:08
`prek` assumes that `git` is on the `PATH`.

`prek` will attempt to download `uv` if it's not on the `PATH`, but the
downloaded executable is not compatible with NixOS. `prek` also assumes
`python` is on the `PATH` when dealing with Python-based hooks. Because
of this I've bundled those under a `withPythonSupport` flag. This flag
defaults to `false` for compatibility with the original code, and to
keep the package the minimal size by default.

Closes <j178/prek#1707>.
@l0b0 l0b0 force-pushed the bundle_uv_with_prek branch from 3313f7a to 38f2cae Compare March 26, 2026 09:13
@nixpkgs-ci nixpkgs-ci bot added 12.approvals: 2 This PR was reviewed and approved by two persons. and removed 12.approvals: 1 This PR was reviewed and approved by one person. labels Mar 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. 12.approvals: 2 This PR was reviewed and approved by two persons. 12.approved-by: package-maintainer This PR was reviewed and approved by a maintainer listed in any of the changed packages.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"Failed to create Python virtual environment" because of unknown missing file

4 participants