From 2930e07754996e5f3ddf2cb12129977b74a1eceb Mon Sep 17 00:00:00 2001 From: Melorise <0d00@0721.hk> Date: Wed, 28 Oct 2026 00:47:11 +0800 Subject: [PATCH] add frozen branches --- .github/workflows/mirror-nixpkgs-frozen.yml | 39 +++++++++++++++++++++ README.md | 6 +++- 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/mirror-nixpkgs-frozen.yml diff --git a/.github/workflows/mirror-nixpkgs-frozen.yml b/.github/workflows/mirror-nixpkgs-frozen.yml new file mode 100644 index 000000000..225eb5257 --- /dev/null +++ b/.github/workflows/mirror-nixpkgs-frozen.yml @@ -0,0 +1,39 @@ +name: Mirror Nixpkgs Frozen Branches + +on: + workflow_dispatch: + +permissions: + contents: write + +jobs: + mirror: + runs-on: ubuntu-latest + steps: + - name: Mirror upstream branches + env: + NIX_BRANCH_TOKEN: ${{ secrets.NIX_BRANCH_TOKEN }} + TARGET_REPOSITORY: ${{ github.repository }} + run: | + set -euo pipefail + : "${NIX_BRANCH_TOKEN:?Set the NIX_BRANCH_TOKEN repository secret.}" + + for branch in nixos-26.05 nixos-unstable; do + archive="$(mktemp)" + checkout="$(mktemp -d)" + + curl --fail --location --retry 3 \ + "https://codeload.github.com/NixOS/nixpkgs/tar.gz/refs/heads/$branch" \ + --output "$archive" + tar --extract --gzip --file "$archive" --strip-components=1 --directory "$checkout" + + git -C "$checkout" init + git -C "$checkout" config user.name "github-actions[bot]" + git -C "$checkout" config user.email "41898282+github-actions[bot]@users.noreply.github.com" + git -C "$checkout" add --all + git -C "$checkout" commit --message "Snapshot of NixOS/nixpkgs $branch" + git -C "$checkout" remote add target \ + "https://x-access-token:${NIX_BRANCH_TOKEN}@github.com/${TARGET_REPOSITORY}.git" + git -C "$checkout" push --force target "HEAD:refs/heads/frozen/$branch" + + done diff --git a/README.md b/README.md index c3c865c9e..e8d48cbfc 100644 --- a/README.md +++ b/README.md @@ -2,5 +2,9 @@ 我使用NixOS主要追求的是声明式配置,不太在乎可复现性。 由于储存涨价的大势所趋(雾),如果每个项目使用来自上游的独立的nixpkgs输入的话,可能会安装不同的版本,造成存储占用过大。 本镜像每周会同步一次,这是我个人比较能接受的更新频率。 -## 注意:每次同步都会强制覆盖提交历史,只保留最新提交,如果追求可复现性,切勿使用本输入源! + +## 注意:每次同步都会强制覆盖提交历史,只保留最新提交,如果追求可复现性,切勿使用本输入源! + +# 2026.10.28更新:新增frozen系列源 +一些软件包我实在不想频繁更新, frozen/*分支的镜像更新只能手动执行,会长期冻结在某个输入,可能不定期更新一次。