Skip to content

nix: use uv2nix for managing the documentation's dependencies #6480

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

winterqt
Copy link
Member

@winterqt winterqt commented May 8, 2025

Since 8e15a26, we now depend on NumPy to build the docs, which is a departure from our previous happy path of not needing C extensions/platform-specific wheels, which unfortunately break on NixOS.

uv2nix luckily does the hard work for us and makes everything (including patching wheels and falling back to source compilation) pretty easy to do. This is arguably preferrable to solutions like 0, as now we don't have to deal with breakages like 1, and will be able to extend our Python dependency footprint in the future without much fuss.

Checklist

If applicable:

  • I have updated CHANGELOG.md
  • I have updated the documentation (README.md, docs/, demos/)
  • I have updated the config schema (cli/src/config-schema.json)
  • I have added tests to cover my changes

@winterqt
Copy link
Member Author

winterqt commented May 8, 2025

This is a draft for now while I try to figure out a good way to remove the https://github.com/pyproject-nix/build-system-pkgs dependency (we may need it but probably will be able to remove it at some point -- details to come) and an issue involving uv's venv management, but it does work if you ignore those issues. cc @thoughtpolice @steadmon for testing.

If we decide to not go this route due to the added complexity, that's fine. :)

Copy link
Contributor

@emilazy emilazy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this require IFD? If not, it looks fine.

@@ -161,6 +175,15 @@
});

devShells.default = let
uvWorkspace = uv2nix.lib.workspace.loadWorkspace { workspaceRoot = pkgs.lib.fileset.toSource { root = ./.; fileset = pkgs.lib.fileset.unions [ ./pyproject.toml ./uv.lock ]; }; };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let’s avoid filesets until they have non‐broken semantics.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough -- to clarify, you don't mean the chroot bug?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do. It’s not really a bug so much as an infelicity in the semantics, anyway. linkFarm … { "pyproject.toml" = ./pyproject.toml; "uv.lock" = ./uv.lock; } should be adequate here.

@steadmon
Copy link
Member

steadmon commented May 8, 2025

Works for me on both NixOS and Debian.

@winterqt
Copy link
Member Author

winterqt commented May 8, 2025

Does this require IFD?

No:

winter@snowball ~/s/jj (empty)> nix eval .#devShells.aarch64-darwin.default --option allow-import-from-derivation false
trace: evaluation warning: darwin.apple_sdk_11_0.*: these stubs do nothing and will be removed in Nixpkgs 25.11; see <https://nixos.org/manual/nixpkgs/stable/#sec-darwin> for documentation and migration instructions
«derivation /nix/store/3k9fdqxwhdjzsb7c6w5fmrkspdvdxi0w-jujutsu.drv»

Since 8e15a26, we now depend on NumPy
to build the docs, which is a departure from our previous happy path
of not needing C extensions/platform-specific wheels, which unfortunately
break on NixOS.

uv2nix luckily does the hard work for us and makes everything (including
patching wheels and falling back to source compilation) pretty easy to
do. This is arguably preferrable to solutions like [0], as now we don't
have to deal with breakages like [1], and will be able to extend
our Python dependency footprint in the future without much fuss.

[0]: jj-vcs#6472
[1]: jj-vcs#6472 (comment)
@winterqt winterqt force-pushed the push-krpxqvnlkqox branch from bb2ed8a to b2ced09 Compare May 15, 2025 03:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants