Skip to content

fix(nix): forward the .vig-os hook knobs through mkRustProject - #1835

Merged
gerchowl merged 2 commits into
devfrom
bugfix/1810-rust-project-hook-knobs
Oct 5, 2026
Merged

gerchowl merged 2 commits into
devfrom
bugfix/1810-rust-project-hook-knobs

Conversation

@gerchowl

@gerchowl gerchowl commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

Description

lib.mkRustProject builds its dev shell through mkProjectShell but did not accept the four .vig-os hook settings. A Rust flake therefore had nowhere to pass branchTypes / commitTypes / refsPolicy / refsOptionalTypes. Its DEVKIT_* settings were silently ignored by the generated branch guard and commit-message hook, and the manifest bindings the flake reads went unused, which fails deadnix on the first commit touching flake.nix.

Stack 1/6 for #1833 (Rust cold adoption). Base: dev.

Type of Change

  • fix -- Bug fix
  • test -- Adding or updating tests

Changes Made

Changelog Entry

Fixed

  • mkRustProject forwards the .vig-os hook settings (#1810)
    • lib.mkRustProject accepts branchTypes, commitTypes, refsPolicy and refsOptionalTypes and passes them to mkProjectShell, so a Rust repo's DEVKIT_BRANCH_TYPES / DEVKIT_COMMIT_TYPES / DEVKIT_REFS_POLICY / DEVKIT_REFS_OPTIONAL_TYPES reach the flake-generated branch guard and commit-message hook instead of being silently ignored
    • A Rust flake no longer has to drop or # deadnix: skip the manifest bindings it reads, which made the first commit touching flake.nix fail deadnix

Testing

  • test_mk_rust_project_forwards_the_vig_os_hook_knobs builds the Rust dev shell's generated hook config and checks the rendered argv: --types carries the custom type, --refs-optional-types is chore,record (taking precedence over refsPolicy = "required"), and the branch guard carries the custom branch type. It failed first with unexpected argument 'branchTypes'.
  • All mk_rust_project tests in tests/test_flake_modules.py pass locally (8 passed).

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have updated CHANGELOG.md in the [Unreleased] section (and pasted the entry above)
  • I have added tests that prove my fix is effective or that my feature works

Refs: #1810, #1833

@gerchowl gerchowl self-assigned this Oct 5, 2026
@gerchowl
gerchowl merged commit 8dbbafa into dev Oct 5, 2026
18 checks passed
@gerchowl
gerchowl deleted the bugfix/1810-rust-project-hook-knobs branch October 5, 2026 21:31
gerchowl added a commit that referenced this pull request Oct 5, 2026
## Description

`mkRustProject`'s `nextest` check runs inside the Nix build sandbox,
where tests that need a PTY, process groups, signals or the network
cannot pass. Before this PR a consumer had two options: `nextest =
false`, which also dropped every test the sandbox *can* run, or an
undocumented `craneArgs` patch. This adds a named seam for it.

**Stack 2/6** for #1833. Base: #1835
(`bugfix/1810-rust-project-hook-knobs`).

## Type of Change

- [x] `feat` -- New feature
- [x] `test` -- Adding or updating tests

## Changes Made

- `nix/mk-rust-project.nix`: new `sandboxExcludes ? [ ]`, a list of
nextest filterset expressions. They are rendered into a single `-E 'not
(a) and not (b)'`, because nextest *unions* repeated `-E` flags, so
per-exclusion flags would still run everything. The filter is composed
with any `cargoNextestExtraArgs` the consumer passes through
`craneArgs`, never assigned over it.
- Malformed input (not a list, or an empty entry) fails eval with
`sandboxExcludes must be …`.
- Only `checks.nextest` is affected. The excluded tests stay in `just
test` and CI through the Rust `justfile.project` that #1496 (stack 3/6)
seeds. The adopter docs for the seam land with #1831 (stack 4/6).

## Changelog Entry

### Added
- **`mkRustProject` `sandboxExcludes` for tests the Nix sandbox cannot
run** ([#1834](#1834))
- A list of nextest filterset expressions (e.g. `[ "test(pty_)"
"binary(supervisor)" ]`) that `checks.nextest` skips, for suites that
need a PTY, process groups, signals or the network
- The excluded tests stay in `just test` and CI; only the sandboxed
flake check skips them, so a repo no longer has to choose between
`nextest = false` and a red `nix flake check`

## Testing

- [x]
`test_mk_rust_project_sandbox_excludes_skip_tests_in_the_nextest_check`
**builds** `checks.nextest` on a fixture crate whose `needs_a_pty` test
always panics. Without the exclusion the build must fail on that test
(the control); with `sandboxExcludes = [ "test(needs_a_pty)" ]` it must
succeed. Only nextest itself can prove that the filter expression
matches.
- [x] `…_compose_with_crane_args`: two exclusions and a consumer's
`--no-fail-fast` all reach the check phase.
- [x] `…_rejects_a_malformed_sandbox_excludes`: a non-list and an empty
entry are refused by name.
- [x] `tests/test_flake_modules.py`: 36 passed locally.

## Checklist

- [x] My code follows the project's style guidelines
- [x] I have performed a self-review of my code
- [x] I have commented my code, particularly in hard-to-understand areas
- [x] I have updated `CHANGELOG.md` in the `[Unreleased]` section (and
pasted the entry above)
- [x] I have added tests that prove my fix is effective or that my
feature works

Refs: #1834, #1833
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