Skip to content

Commit 79fe49c

Browse files
committed
make uv2nix and pyproject-build-systems updatable by CI
1 parent 559106b commit 79fe49c

File tree

6 files changed

+69
-19
lines changed

6 files changed

+69
-19
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,6 @@ To keep your project up to date with the most recent version of this template, w
77
```bash
88
cruft create https://github.com/runtimeverification/python-project-template
99
```
10+
11+
### uv2nix
12+
`uv2nix` and `pyproject-build-systems` should be periodically updated. The `update-version.yml` workflow handles updates of both dependencies, but it is required that the new project and both dependencies are added to `deps-cron.json` in the [devops repository](https://github.com/runtimeverification/devops).

cookiecutter.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,8 @@
55
"version": "0.1.0",
66
"description": "",
77
"author_name": "Runtime Verification, Inc.",
8-
"author_email": "contact@runtimeverification.com"
8+
"author_email": "contact@runtimeverification.com",
9+
"_copy_without_render": [
10+
".github/workflows/*.yml"
11+
]
912
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
name: 'Update Version'
3+
on:
4+
push:
5+
branches:
6+
- '_update-deps-cron/uv2nix'
7+
- '_update-deps-cron/pyproject-build-systems'
8+
workflow_dispatch:
9+
# Stop in progress workflows on the same branch and same workflow to use latest committed code
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
14+
jobs:
15+
update-versions:
16+
name: 'Update Dependency Versions'
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: 'Check out code'
20+
uses: actions/checkout@v3
21+
with:
22+
submodules: recursive
23+
token: ${{ secrets.JENKINS_GITHUB_PAT }}
24+
fetch-depth: 0
25+
- name: 'Configure GitHub user'
26+
run: |
27+
git config user.name devops
28+
git config user.email devops@runtimeverification.com
29+
- name: 'Install Nix'
30+
uses: cachix/install-nix-action@v31.2.0
31+
with:
32+
install_url: https://releases.nixos.org/nix/nix-2.24.12/install
33+
extra_nix_config: |
34+
substituters = http://cache.nixos.org https://cache.iog.io
35+
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ=
36+
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
37+
- uses: cachix/cachix-action@v16
38+
with:
39+
name: k-framework
40+
authToken: ${{ secrets.CACHIX_PUBLIC_TOKEN }}
41+
- name: 'Update Nix flake inputs'
42+
run: |
43+
UV2NIX_VERSION=$(cat deps/uv2nix)
44+
PYPROJECT_BUILD_SYSTEMS_VERSION=$(cat deps/pyproject-build-systems)
45+
sed -i 's! uv2nix.url = "github:pyproject-nix/uv2nix/[a-z0-9\.]*"! uv2nix.url = "github:pyproject-nix/uv2nix/'"${UV2NIX_VERSION}"'"!' flake.nix
46+
sed -i 's! pyproject-build-systems.url = "github:pyproject-nix/build-system-pkgs/[a-z0-9\.]*"! pyproject-build-systems.url = "github:pyproject-nix/build-system-pkgs/'"${PYPROJECT_BUILD_SYSTEMS_VERSION}"'"!' flake.nix
47+
nix flake update
48+
git add flake.nix flake.lock && git commit -m 'flake.{nix,lock}: update Nix derivations' || true
49+
- name: 'Push updates'
50+
run: git push
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
7dba6dbc73120e15b558754c26024f6c93015dd7
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
680e2f8e637bc79b84268949d2f2b2f5e5f1d81c

{{cookiecutter.project_slug}}/flake.nix

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,19 @@
33
inputs = {
44
nixpkgs.url = "nixpkgs/nixos-unstable";
55
flake-utils.url = "github:numtide/flake-utils";
6-
pyproject-nix = {
7-
url = "github:pyproject-nix/pyproject.nix";
8-
inputs.nixpkgs.follows = "uv2nix/nixpkgs";
9-
# inputs.uv2nix.follows = "nixpkgs";
10-
};
6+
uv2nix.url = "github:pyproject-nix/uv2nix/680e2f8e637bc79b84268949d2f2b2f5e5f1d81c";
7+
# stale nixpkgs is missing the alias `lib.match` -> `builtins.match`
8+
# therefore point uv2nix to a patched nixpkgs, which introduces this alias
9+
# this is a temporary solution until nixpkgs us up-to-date again
10+
uv2nix.inputs.nixpkgs.url = "github:runtimeverification/nixpkgs/libmatch";
11+
# inputs.nixpkgs.follows = "nixpkgs";
12+
pyproject-build-systems.url = "github:pyproject-nix/build-system-pkgs/7dba6dbc73120e15b558754c26024f6c93015dd7";
1113
pyproject-build-systems = {
12-
url = "github:pyproject-nix/build-system-pkgs";
13-
inputs.pyproject-nix.follows = "pyproject-nix";
14-
inputs.uv2nix.follows = "uv2nix";
1514
inputs.nixpkgs.follows = "uv2nix/nixpkgs";
16-
# inputs.uv2nix.follows = "nixpkgs";
17-
};
18-
uv2nix = {
19-
url = "github:pyproject-nix/uv2nix";
20-
inputs.pyproject-nix.follows = "pyproject-nix";
21-
# stale nixpkgs is missing the alias `lib.match` -> `builtins.match`
22-
# therefore point uv2nix to a patched nixpkgs, which introduces this alias
23-
# this is a temporary solution until nixpkgs us up-to-date again
24-
inputs.nixpkgs.url = "github:runtimeverification/nixpkgs/libmatch";
25-
# inputs.uv2nix.follows = "nixpkgs";
15+
inputs.uv2nix.follows = "uv2nix";
16+
inputs.pyproject-nix.follows = "uv2nix/pyproject-nix";
2617
};
18+
pyproject-nix.follows = "uv2nix/pyproject-nix";
2719
};
2820
outputs = { self, nixpkgs, flake-utils, pyproject-nix, pyproject-build-systems, uv2nix }:
2921
let

0 commit comments

Comments
 (0)