Skip to content

Conversation

@carbolymer
Copy link
Contributor

Changelog

- description: |
    nix: Add alejandra, prettify and cabal-gild git hook
# uncomment types applicable to the change:
  type:
  # - feature        # introduces a new feature
  # - breaking       # the API has changed in a breaking way
  # - compatible     # the API has changed but is non-breaking
  # - optimisation   # measurable performance improvements
  # - refactoring    # QoL changes
  # - bugfix         # fixes a defect
  # - test           # fixes/modifies tests
   - maintenance    # not directly related to the code
  # - release        # related to a new release preparation
  # - documentation  # change in code docs, haddocks...
# uncomment at least one main project this PR is associated with
  projects:
   - cardano-api
  # - cardano-api-gen
  # - cardano-rpc
  # - cardano-wasm

Context

Additional context for the PR goes here. If the PR fixes a particular issue please provide a link to the issue.

How to trust this PR

Highlight important bits of the PR that will make the review faster. If there are commands the reviewer can run to observe the new behavior, describe them.

Checklist

  • Commit sequence broadly makes sense and commits have useful messages
  • New tests are added if needed and existing tests are updated. See Running tests for more details
  • Self-reviewed the diff

@carbolymer carbolymer force-pushed the mgalazyn/chore/bump-ghc-add-devshell-hooks branch 3 times, most recently from 5ae5a90 to e659469 Compare October 24, 2025 14:11
Copy link
Contributor

@palas palas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was testing the hook for cabal-gild and I am getting this for a perfectly valid cardano-api.cabal file:

HasCallStack backtrace:
  collectBacktraces, called at libraries/ghc-internal/src/GHC/Internal/Exception.hs:169:13 in ghc-internal:GHC.Internal.Exception
  toExceptionWithBacktrace, called at libraries/ghc-internal/src/GHC/Internal/IO.hs:260:11 in ghc-internal:GHC.Internal.IO
  throwIO, called at libraries/ghc-internal/src/GHC/Internal/Control/Exception/Base.hs:195:43 in ghc-internal:GHC.Internal.Control.Exception.Base

So we should fix this before merging, I'll give it a go

@palas palas force-pushed the mgalazyn/chore/bump-ghc-add-devshell-hooks branch from e753b4b to 04c4a4e Compare October 24, 2025 18:04
@palas palas force-pushed the mgalazyn/chore/bump-ghc-add-devshell-hooks branch from 04c4a4e to 3dc1a11 Compare October 24, 2025 18:25
Copy link
Contributor

@palas palas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I fixed it now, and also rebased the branch

in
builtins.toString script;
files = "\\.cabal$";
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I copied this from https://github.com/cachix/git-hooks.nix/blob/ca5b894d3e3e151ffc1db040b6ce4dcc75d31c37/modules/hooks.nix#L2303:

I imagine it could be made simpler by modifying the package field instead of entry, but I am not sure where in the flake to get it from, and this works fine.

Another thing is that it looks like the scripts/githooks/haskell-style-lint hook, already checks this, but it is probably nicer to have it separate as it is now

Copy link
Contributor Author

@carbolymer carbolymer Oct 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I imagine it could be made simpler by modifying the package field instead of entry

I tried that, but like you wrote - I'm not sure how to extract the exact package version used in nix shell. With entry it just uses whatever is in nix shell already.

Another thing is that it looks like the scripts/githooks/haskell-style-lint hook, already checks this, but it is probably nicer to have it separate as it is now

I somehow missed that. I'm inclined to remove the separate cabal-gild then.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not bad it has its specific check, because that way it specifically says that it was cabal-gild that failed. But either way it is fine with me

@carbolymer carbolymer self-assigned this Oct 28, 2025
@carbolymer carbolymer added this pull request to the merge queue Oct 30, 2025
Merged via the queue into master with commit 4a70f77 Oct 30, 2025
29 checks passed
@carbolymer carbolymer deleted the mgalazyn/chore/bump-ghc-add-devshell-hooks branch October 30, 2025 12:41
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.

4 participants