Repository navigation
Lint Nix code with deadnix and statix - #370
Merged
Merged
Conversation
seberm
marked this pull request as ready for review
December 1, 2026 14:33
Contributor
|
@prusnak Thanks! I'll merge this one (still running a review) and then open a follow-up that:
nixfmt will come later in its own formatting-only PR. |
clightning announced the port of the first mapping of its onion service. When another mapping came first, peers dialed a port that doesn't reach clightning. Pick the mapping to the peer port, as lnd does. Without one, fall back to the first mapping, as before. Assisted-by: Claude Code (Claude Opus 5.5)
…itcoinix#358) With a public clightning onion service, clightning announced the port of the first mapping of the onion service. When another mapping came first, for example one added with `mkBefore`, peers dialed a port that doesn't reach clightning. Now it picks the mapping to clightning's peer port, as lnd does. Without one, it falls back to the first mapping, so those configs announce the same port as before. Item 10 of bitcoinix#316. The new `testClightningAnnouncesPeerOnionPort` check fails on master and when no mapping matches, and `module-config` passes. A mapping to another address on the same port still counts, as in lnd's lookup. Claude Fable 5.2 triaged bitcoinix#316 and Claude Opus 5.5 wrote this. DeepSeek V4.1 Flash 1017 (max), Gemini 4 Carbon (high), Gemini 4 Neon (high), Claude Opus 5.5 (high) and GPT-6 Astra (max) reviewed it over two rounds. They found that the first test couldn't tell a match from the fallback, and that the fallback had to stay the first mapping.
sebsgent
commented
Dec 1, 2026
sebsgent
left a comment
Contributor
Author
There was a problem hiding this comment.
LGTM, no must/should items.
Optional:
- Commit message of fb7b5af and the PR body: "201 of the 257 statix warnings" counts
statix check -o errfmtoutput lines, not warnings. On master it is 67repeated_keyswarnings out of 123.
Tested: compared every standalone test scenario (48) between master and the PR head: identical system toplevel outPaths, test scripts and drivers, including scenarios not in CI (full, hardened, clightning-replication, trustedcoin); the fetchNodeModules env change only alters the fixed-output derivation, not any output path. Negative controls: deadnix fails on an unused binding, statix fails on a lint, repeated_keys stays disabled. CI built and passed nix-lint.
Assisted-by: Claude Code (Claude Opus 5.5)
Apply statix's suggestions: inherit instead of manual assignments, drop useless parentheses, an empty pattern and a redundant pattern bind. Rewrite a few autofixes by hand where the result was hard to read. fetchNodeModules declared defaults for runScripts and npmFlags but passed only the caller's args to the derivation, so the defaults never reached the build script. Pass them explicitly; the build does the same as before, because unset and false both leave the variable empty. Mark the remaining intentionally unused bindings with `# deadnix: skip`: makeShell's shellVersion argument, which existing shell.nix files still pass, and exampleScenarios in test/tests.nix, which dev/dev-env/template-scenarios.nix points to as documentation. Assisted-by: Claude Code (claude-opus-5-5)
Add the nix-lint flake check, which fails on unused bindings and arguments (deadnix) and on statix lints. The check_flake CI job runs it via `nix flake check`, so no new job is needed. Both tools are in the dev shell for local use. statix.toml disables repeated_keys: splitting options across several `services.x = …;` assignments is idiomatic in NixOS modules, and the lint accounted for 67 of the 123 statix warnings on master. Assisted-by: Claude Code (claude-opus-5-5)
This was referenced Dec 1, 2026
seberm
added a commit
that referenced
this pull request
Dec 1, 2026
Each linter is defined once in test/lint.nix (actionlint, deadnix, shellcheck, statix and zizmor) and runs as its own flake check and as a job of a new `lint` CI matrix, so a failing linter is visible without opening the logs. The matrix replaces the shellcheck job and is required by ci_gate; the ci-workflows check keeps the matrix in sync with lint.nix. `./test/run-tests.sh lint` runs all linters locally, and an optional pre-commit hook (.#pre-commit-hook) runs them on the staged tree. The workflows are hardened for zizmor's findings: checkouts no longer persist the GitHub token, the labeler's pull-requests write permission is granted per job, the docs site path no longer goes through GITHUB_ENV, and the pull_request_target and workflow_run triggers are documented as safe and marked as accepted findings. Follow-up to #370
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.
Follow-up to #369, whose unused-binding cleanup was done by hand. deadnix would have found almost all of it.
Changes
nix-lintflake check:deadnix --fail(unused bindings and arguments) andstatix check. The existingcheck_flakejob runs it throughnix flake check, so there is no new CI job andci_gateis unchanged.statix.tomldisablesrepeated_keys. Splitting options across severalservices.x = …;assignments is normal in NixOS modules, and this lint accounted for 67 of the 123 statix warnings on master.nix developfor local use.test/README.mdandAGENTS.mddescribe the check.inherit, useless parentheses), with a few rewritten by hand for readability.fetchNodeModules: therunScriptsandnpmFlagsdefaults never reached the build, because only the caller's arguments were passed. They are now passed explicitly. The build does the same as before.# deadnix: skip:shellVersioninhelper/makeShell.nix(existingshell.nixfiles still pass it) andexampleScenariosintest/tests.nix(kept as documentation).Not included: nixfmt
nixfmtwould reformat 114 of 177.nixfiles (+12.7k/−8k lines) and conflict with most open PRs. That belongs in a separate formatting-only PR, together with aformatterflake output, a format check and.git-blame-ignore-revs, landed when few PRs are open.Testing
nix build .#checks.x86_64-linux.nix-lintpasses, and fails after adding an unused binding (negative control).nix eval .#checks.x86_64-linux.module-config.testCountevaluates (247 tests).full,hardened,clightning-replication,trustedcoin). ThefetchNodeModuleschange alters only the fixed-output derivation, not its output path.nix flake check, VM scenarios and deployment examples are left to CI.Assisted-by: Claude Code (claude-opus-5-5)