Skip to content

Commit bac1cc8

Browse files
authored
Merge pull request #10 from dolphin-emu/uv-conversion
Project: Convert to uv and update nixpkgs to 25.05
2 parents ba5f8b9 + 434f10b commit bac1cc8

File tree

7 files changed

+776
-1386
lines changed

7 files changed

+776
-1386
lines changed

.github/workflows/run-tests.yml

Lines changed: 9 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -9,44 +9,24 @@ permissions:
99
contents: read
1010

1111
jobs:
12-
# Inspiration taken from https://jacobian.org/til/github-actions-poetry/
1312
run-tests:
1413
runs-on: ubuntu-latest
1514
steps:
1615
- uses: actions/checkout@v3
1716

18-
- name: Set up Python 3.10
19-
uses: actions/setup-python@v3
17+
- name: Set up Python
18+
uses: actions/setup-python@v5
2019
with:
21-
python-version: "3.10"
20+
python-version-file: "pyproject.toml"
2221

23-
- name: Cache Poetry install
24-
uses: actions/cache@v4
25-
with:
26-
path: ~/.local
27-
key: poetry-1.3.0-0
28-
29-
- uses: snok/install-poetry@v1
30-
with:
31-
version: 1.3.0
32-
virtualenvs-create: true
33-
virtualenvs-in-project: true
34-
35-
- name: Cache dependencies
36-
uses: actions/cache@v4
37-
with:
38-
path: .venv
39-
key: pydeps-${{ hashFiles('**/poetry.lock') }}
40-
41-
- name: Install dependencies (if uncached)
42-
run: poetry install --no-interaction --no-root
43-
if: steps.cache-deps.outputs.cache-hit != 'true'
22+
- name: Install uv
23+
uses: astral-sh/setup-uv@v6
4424

45-
- name: Install central
46-
run: poetry install --no-interaction
25+
- name: Sync dependencies
26+
run: uv sync --locked --all-extras --dev
4727

4828
- name: Run unit tests
49-
run: poetry run pytest
29+
run: uv run pytest
5030

5131
- name: Check coding style
52-
run: poetry run black --check .
32+
run: uv run black --check .

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ $ nix run
2222

2323
```bash
2424
$ nix develop
25-
$ poetry install
26-
$ poetry run black --check .
27-
$ poetry run pytest
28-
$ poetry run central
25+
$ uv sync
26+
$ uv run black --check .
27+
$ uv run pytest
28+
$ uv run central
2929
```

flake.lock

Lines changed: 63 additions & 82 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 46 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,54 @@
22
description = "Central, Dolphin's CI/CD plumbing infrastructure";
33

44
inputs.flake-utils.url = "github:numtide/flake-utils";
5-
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05";
6-
inputs.poetry2nix.url = "github:nix-community/poetry2nix";
7-
inputs.poetry2nix.inputs.nixpkgs.follows = "nixpkgs";
5+
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05";
86

9-
outputs = { self, nixpkgs, flake-utils, poetry2nix }: {
10-
overlay = nixpkgs.lib.composeManyExtensions [
11-
poetry2nix.overlays.default
12-
(final: prev: {
13-
central = prev.poetry2nix.mkPoetryApplication {
14-
projectDir = ./.;
15-
overrides = prev.poetry2nix.defaultPoetryOverrides.extend (self: super: {
16-
pypeul = super.pypeul.overridePythonAttrs (old: { buildInputs = (old.buildInputs or []) ++ [ super.poetry-core ]; });
17-
});
7+
inputs.uv2nix.url = "github:pyproject-nix/uv2nix";
8+
inputs.uv2nix.inputs.nixpkgs.follows = "nixpkgs";
9+
inputs.uv2nix.inputs.pyproject-nix.follows = "pyproject-nix";
10+
11+
inputs.pyproject-nix.url = "github:pyproject-nix/pyproject.nix";
12+
inputs.pyproject-nix.inputs.nixpkgs.follows = "nixpkgs";
13+
14+
inputs.pyproject-build-systems.url = "github:pyproject-nix/build-system-pkgs";
15+
inputs.pyproject-build-systems.inputs.nixpkgs.follows = "nixpkgs";
16+
inputs.pyproject-build-systems.inputs.pyproject-nix.follows = "pyproject-nix";
17+
18+
outputs = { self, nixpkgs, flake-utils, uv2nix, pyproject-nix, pyproject-build-systems }:
19+
let
20+
perSystem = flake-utils.lib.eachDefaultSystem (system:
21+
let
22+
pkgs = import nixpkgs { inherit system; };
23+
workspace = uv2nix.lib.workspace.loadWorkspace { workspaceRoot = ./.; };
24+
overlay = workspace.mkPyprojectOverlay {
25+
sourcePreference = "wheel";
1826
};
19-
})
20-
];
21-
} // (flake-utils.lib.eachDefaultSystem (system:
22-
let
23-
pkgs = import nixpkgs {
24-
inherit system;
25-
overlays = [ self.overlay ];
26-
};
27-
in rec {
28-
packages.central = pkgs.central;
29-
defaultPackage = pkgs.central;
27+
python = pkgs.python310;
28+
pythonSet =
29+
(pkgs.callPackage pyproject-nix.build.packages { inherit python; })
30+
.overrideScope (pkgs.lib.composeManyExtensions [
31+
pyproject-build-systems.overlays.default
32+
overlay
33+
]);
34+
venv = pythonSet.mkVirtualEnv "central-env" workspace.deps.default;
35+
in {
36+
packages.central = venv;
37+
packages.default = venv;
3038

31-
devShells.default = with pkgs; mkShell {
32-
buildInputs = [ poetry ];
39+
apps.default = {
40+
type = "app";
41+
program = "${venv}/bin/central";
42+
};
43+
44+
devShells.default = pkgs.mkShell {
45+
packages = [ pkgs.uv ];
46+
};
47+
});
48+
in
49+
perSystem // {
50+
overlays.default = final: prev: {
51+
central = self.packages.${final.system}.central;
3352
};
34-
}
35-
));
53+
overlay = self.overlays.default;
54+
};
3655
}

0 commit comments

Comments
 (0)