Add nix/ci.nix and enforce hlint in CI#34
Merged
Conversation
CI was calling 'nix-build' (== default.nix), which only produces the
cabal build derivation; .hlint.yaml was a sample file with no
enforcement, so projects derived from this template silently drifted
away from their lint configuration.
Introduces 'nix/ci.nix' with two attrs:
- native: imports default.nix, so 'nix-build nix/ci.nix' still
produces the cabal build derivation
- hlint: runs 'hlint -h .hlint.yaml app src test' inside a
'pkgs.runCommand' derivation, pinning the hlint binary
to the same nixpkgs as the rest of the toolchain
The GitHub Actions 'nix' job is updated to 'nix-build nix/ci.nix' so
the hlint pass runs alongside the build instead of needing a separate
workflow step. The cabal-only matrix job is unchanged — it doesn't
have nix available.
Mirrors the same pattern used in jappeace/mijn-webwinkel-migraine's
nix/ci.nix.
Prompt: add the same idea to haskell-template-project. we want hlint
enabled in ci.nix
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
nix/ci.nixwith two attrs:native(importsdefault.nix, the existing cabal build) andhlint(runshlint -h .hlint.yaml app src testviapkgs.runCommand, pinning the hlint version to the project's nixpkgs).nixjob now runsnix-build nix/ci.nixinstead ofnix-build, so the hlint pass is enforced alongside the build. The matrixcabaljob is unchanged (no nix available).jappeace/mijn-webwinkel-migraine'snix/ci.nix.Test plan
nix-build nix/ci.nixbuilds locally — bothnativeandci-hlintderivations come back green; hlint reports "No hints" against the currentapp/src/testtree.hlint.yamlalready existed in the template; CI was just not invoking hlintnixjob runsnix-build nix/ci.nixon this PR🤖 Generated with Claude Code