Skip to content

Commit

Permalink
Merge pull request #471 from amesgen/cabal-gild
Browse files Browse the repository at this point in the history
feat: add cabal-gild
  • Loading branch information
domenkozar authored Jul 9, 2024
2 parents 2b6bd3c + 11e7fbf commit 2189f6b
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 5 deletions.
8 changes: 4 additions & 4 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
description = "Seamless integration of https://pre-commit.com git hooks with Nix.";

inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
inputs.nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-23.11";
inputs.nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-24.05";
inputs.flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
Expand Down
16 changes: 16 additions & 0 deletions modules/hooks.nix
Original file line number Diff line number Diff line change
Expand Up @@ -1813,6 +1813,22 @@ in
entry = "${hooks.cabal-fmt.package}/bin/cabal-fmt --inplace";
files = "\\.cabal$";
};
cabal-gild =
{
name = "cabal-gild";
description = "Format Cabal files";
package = tools.cabal-gild;
entry =
let
script = pkgs.writeShellScript "precommit-cabal-gild" ''
for file in "$@"; do
${hooks.cabal-gild.package}/bin/cabal-gild --io="$file"
done
'';
in
builtins.toString script;
files = "\\.cabal$";
};
cabal2nix =
{
name = "cabal2nix";
Expand Down
1 change: 1 addition & 0 deletions nix/call-tools.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ pkgs:
pkgs.lib.flip builtins.removeAttrs [ "override" "overrideDerivation" ]
(pkgs.callPackage ./tools.nix {
cabal-fmt = (pkgs.haskell.lib.enableSeparateBinOutput pkgs.haskellPackages.cabal-fmt).bin;
cabal-gild = (pkgs.haskell.lib.enableSeparateBinOutput pkgs.haskellPackages.cabal-gild).bin;
hindent = pkgs.haskell.lib.enableSeparateBinOutput pkgs.haskellPackages.hindent;
})
2 changes: 2 additions & 0 deletions nix/tools.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
, ansible-lint
, biome
, cabal-fmt
, cabal-gild
, cabal2nix
, callPackage
, cargo
Expand Down Expand Up @@ -99,6 +100,7 @@ in
biome
cabal2nix
cabal-fmt
cabal-gild
cargo
clang-tools
clippy
Expand Down

0 comments on commit 2189f6b

Please sign in to comment.