Skip to content

Commit 2189f6b

Browse files
authored
Merge pull request #471 from amesgen/cabal-gild
feat: add cabal-gild
2 parents 2b6bd3c + 11e7fbf commit 2189f6b

File tree

5 files changed

+24
-5
lines changed

5 files changed

+24
-5
lines changed

flake.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
description = "Seamless integration of https://pre-commit.com git hooks with Nix.";
33

44
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
5-
inputs.nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-23.11";
5+
inputs.nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-24.05";
66
inputs.flake-compat = {
77
url = "github:edolstra/flake-compat";
88
flake = false;

modules/hooks.nix

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1813,6 +1813,22 @@ in
18131813
entry = "${hooks.cabal-fmt.package}/bin/cabal-fmt --inplace";
18141814
files = "\\.cabal$";
18151815
};
1816+
cabal-gild =
1817+
{
1818+
name = "cabal-gild";
1819+
description = "Format Cabal files";
1820+
package = tools.cabal-gild;
1821+
entry =
1822+
let
1823+
script = pkgs.writeShellScript "precommit-cabal-gild" ''
1824+
for file in "$@"; do
1825+
${hooks.cabal-gild.package}/bin/cabal-gild --io="$file"
1826+
done
1827+
'';
1828+
in
1829+
builtins.toString script;
1830+
files = "\\.cabal$";
1831+
};
18161832
cabal2nix =
18171833
{
18181834
name = "cabal2nix";

nix/call-tools.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@ pkgs:
22
pkgs.lib.flip builtins.removeAttrs [ "override" "overrideDerivation" ]
33
(pkgs.callPackage ./tools.nix {
44
cabal-fmt = (pkgs.haskell.lib.enableSeparateBinOutput pkgs.haskellPackages.cabal-fmt).bin;
5+
cabal-gild = (pkgs.haskell.lib.enableSeparateBinOutput pkgs.haskellPackages.cabal-gild).bin;
56
hindent = pkgs.haskell.lib.enableSeparateBinOutput pkgs.haskellPackages.hindent;
67
})

nix/tools.nix

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
, ansible-lint
77
, biome
88
, cabal-fmt
9+
, cabal-gild
910
, cabal2nix
1011
, callPackage
1112
, cargo
@@ -99,6 +100,7 @@ in
99100
biome
100101
cabal2nix
101102
cabal-fmt
103+
cabal-gild
102104
cargo
103105
clang-tools
104106
clippy

0 commit comments

Comments
 (0)