Skip to content

feat: add Nix flake for reproducible builds via uv2nix#234

Open
Sunny-XXV wants to merge 2 commits into
bubbuild:mainfrom
Sunny-XXV:add-nix-flake
Open

feat: add Nix flake for reproducible builds via uv2nix#234
Sunny-XXV wants to merge 2 commits into
bubbuild:mainfrom
Sunny-XXV:add-nix-flake

Conversation

@Sunny-XXV

Copy link
Copy Markdown

Hi 开发者,我是 Nix & NixOS 用户,我尝试为这个项目添加了一个 flake,来方便操作系统环境和我类似的用户。
这个 flake 很简单,基于 uv2nix,所以基本信息大部分都是从项目已有的 pyproject.toml 和 uv.lock 获取的,理论上不需要频繁更新。

可能需要讨论的点:

  1. pyproject.toml 里面没有写当前的版本,但是 pure flake 通常不会去获取 git tag,所以默认用了 [tool.hatch.version] fallback-version = "0.3.0" 作为 HATCH_VCS_PRETEND_VERSION 和 SETUPTOOLS_SCM_PRETEND_VERSION
  2. 默认没有带 dev dependencies 和 optional dependencies

Provides:
- packages.<system>.{default,bub}: bub CLI built from uv.lock (uv2nix, wheel-preferred)
- apps.default: nix run .#bub
- devShells.default (uv) and .locked (pure, from lockfile)
- overlays.default for NixOS / home-manager consumption

Version and Python interpreter are derived from pyproject.toml and
requires-python, not hardcoded.
devShells.default now builds a Nix virtualenv with the local bub installed
editable plus the dev/optional dependency groups (deps.all), and symlinks
it to ./.venv on shell entry so editors and 'uv run' pick up
.venv/bin/python. Editing src/bub/ is reflected live.
@Sunny-XXV

Copy link
Copy Markdown
Author

稍等下,有些 skill 里面的 python script 的依赖是声明在文件开头,依赖 uv 解析的,现在的 flake 可能没法覆盖到这种情况。

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.

1 participant