Skip to content

Commit

Permalink
chore: Move from Poetry to UV
Browse files Browse the repository at this point in the history
See Enalean/tuleap-documentation-en#1619

Part of request #41796 Update dev/build environment [W07 2025]
  • Loading branch information
LeSuisse committed Feb 24, 2025
1 parent 170d4f9 commit c8fd464
Show file tree
Hide file tree
Showing 7 changed files with 366 additions and 501 deletions.
34 changes: 14 additions & 20 deletions build-support/build-tools.nix
Original file line number Diff line number Diff line change
@@ -1,26 +1,20 @@
{ pkgs ? (import ./pinned-nixpkgs.nix) { } }:
[
let
pythonWorkspace = pkgs.uv2nix.lib.workspace.loadWorkspace { workspaceRoot = ../.; };
pythonSet = (pkgs.callPackage pkgs.pyproject-nix.build.packages {
python = pkgs.python3;
}).overrideScope
(
pkgs.lib.composeManyExtensions [
pkgs.pyproject-build-systems
(pythonWorkspace.mkPyprojectOverlay { sourcePreference = "wheel"; })
]
);
pythonVirtualenv = pythonSet.mkVirtualEnv "build-deps" pythonWorkspace.deps.all;
in [
pkgs.gnumake
pkgs.gnugrep
pkgs.gnused
pkgs.gawk
(pkgs.poetry2nix.mkPoetryEnv {
projectDir = ../.;
# Some overrides are needed because some packages do not define their build deps correctly
# https://github.com/nix-community/poetry2nix/blob/master/docs/edgecases.md
overrides = pkgs.poetry2nix.defaultPoetryOverrides.extend (
self: super: {
sphinx = super.sphinx.overridePythonAttrs (
old: {
buildInputs = (old.buildInputs or [ ]) ++ [ self.flit-core ];
}
);
sphinxcontrib-jquery = super.sphinxcontrib-jquery.overridePythonAttrs (
old: {
buildInputs = (old.buildInputs or [ ]) ++ [ self.flit-core ];
}
);
}
);
})
pythonVirtualenv
]
2 changes: 1 addition & 1 deletion build-support/dev-tools.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ pkgs }:
[
pkgs.poetry
pkgs.uv
]
21 changes: 13 additions & 8 deletions build-support/pinned-nixpkgs.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,16 @@ let
url = "https://github.com/NixOS/nixpkgs/archive/5083ec887760adfe12af64830a66807423a859a7.tar.gz";
sha256 = "sha256-D1FNZ70NmQEwNxpSSdTXCSklBH1z2isPR84J6DQrJGs=";
} ) {};
poetry2nixsrc = builtins.fetchTarball {
url = "https://github.com/nix-community/poetry2nix/archive/refs/tags/2024.11.109713.tar.gz";
sha256 = "sha256:04nvlp0lp2kxycdywq0avzxpvyj69iij8xvl6havjmpm26dpbcqp";
};
poetry2nix = import poetry2nixsrc {
pkgs = pinnedNixpkgs;
};
in pinnedNixpkgs // { inherit poetry2nix; }
pyproject-nix = import (builtins.fetchTarball {
url = "https://github.com/pyproject-nix/pyproject.nix/archive/1329712f7f9af3a8b270764ba338a455b7323811.tar.gz";
sha256 = "sha256:1yvqfc6akbimflhgp5b6b4q57rmahgs96m81zbx7gv0299sbi1h2";
}) { lib = pinnedNixpkgs.lib; };
uv2nix = import (builtins.fetchTarball {
url = "https://github.com/pyproject-nix/uv2nix/archive/846ad27167bf6a855c56753ba8360759bfb6f456.tar.gz";
sha256 = "sha256:0ivbg4szn2p6xvjrm9qg9xh8nhd3p7lh88qln596f2kchvv4aysm";
}) { lib = pinnedNixpkgs.lib; inherit pyproject-nix; };
pyproject-build-systems = import (builtins.fetchTarball {
url = "https://github.com/pyproject-nix/build-system-pkgs/archive/53700950d05fc2dd67228277ff1729964d2e7ffd.tar.gz";
sha256 = "sha256:1aipbbwpidzyb4gxpgsc5fr7hiv2xy1zp3400rzzqqkjxd0vr0s8";
}) { lib = pinnedNixpkgs.lib; inherit pyproject-nix uv2nix; };
in pinnedNixpkgs // { inherit pyproject-nix uv2nix pyproject-build-systems; }
Loading

0 comments on commit c8fd464

Please sign in to comment.