WIP: 修复总开关失效 / 自定义 provider 丢失 / License 不一致 + 测试与 CI 改进 - #1
Merged
Conversation
- mirrors.enable=false 不再注入任何 substituters / 环境变量 / 配置文件
(此前每个 mkIf 只检查逐软件 enable, 总开关形同虚设)
- 内置 providerPresets 从 option.default 移到 config 注入,
避免用户加自定义 provider 时内置 10 个 provider (tuna/ustc/...) 全部丢失
- option 类型 attrsOf(attrsOf(nullOr attrs)) 改为 attrsOf(attrsOf attrs),
避免用户 null 与内置 {url=...} 在 module system 合并时报
'defined both null and not null'
- option 类型层面禁止 null, 改用 attrset 中省略字段表达'不提供'
(attrByPath 自动当作 null, 语义等价)
- 补 LICENSE (MIT), 同步 README/flake.nix/CHANGELOG/AGENTS 中的 TBD 标注
断言改造: - checks/mirrors-assertions.nix 改为派生式: expected 从 providers.nix 派生, 避免 URL 改动时双重维护; 同时保留 3 条非派生守护断言检查关键字段存在性 - 新增 checks/mirrors-assertions-edge.nix (5 个场景, 守护历史 bug 不回归): * enable-false-leak: 总开关关闭时零副作用 (全量遍历所有可能被注入的键) * custom-provider-merge: 用户加自定义 provider 时内置 provider 不丢失 * builtin-override: 覆盖内置 provider 字段时其他字段保持不变 * per-software-disable: 逐软件 enable=false 只关停该软件 * substituter-order: mkBefore 让镜像 substituter 排在用户值之前 - flake.nix 引入 mkEvalCheck 工厂, 默认+边缘场景共用 'eval + 比对断言' 基础设施 - module/config.nix 加 NixOS assertions: provider 名拼写错误给出明确告警, 不再静默失败 CI workflow: - .github/workflows/ci.yml: cachix/install-nix-action@v31 + nix develop -c just check (进 devShell 后 lint 工具齐全, 与本地开发环境一致) - .github/workflows/verify-mirrors.yml: 每周一 09:00 (UTC+8) 跑 just verify-mirrors-quiet, 失效自动开 issue (mirror-verify-failed label), 成功自动关闭旧 issue 文档与体验: - README 加 DaoCloud docker 限流提醒 (1 MiB/s, 20 req/min) - CHANGELOG 归档 0.2.0 段
luochen1990
force-pushed
the
fix-mirrors-bugs-20260721-1814
branch
from
July 21, 2026 11:57
3d33e89 to
36c614a
Compare
luochen1990
marked this pull request as ready for review
July 21, 2026 12:16
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
继上次审计发现的 3 个 P0 bug + 5 项 P1/P2 改进, 本次 PR 全部修复.
修复内容
P0 (阻塞级)
P1 (工程改进)
P2 (体验优化)
DoD
验证命令
```bash
nix develop -c just check
nix develop -c just verify-mirrors
```
注意事项