Skip to content

Commit

Permalink
Format .cabal files with cabal-gild
Browse files Browse the repository at this point in the history
  • Loading branch information
amesgen committed Jul 9, 2024
1 parent 7a334ac commit ca45fef
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 39 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
with:
extra_nix_config: |
accept-flake-config = true
- name: Format via Cabal and Ormolu
- name: Format via Ormolu
run: |
nix run .#format
git diff --exit-code --color=always
Expand Down
67 changes: 39 additions & 28 deletions flake.lock

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

9 changes: 3 additions & 6 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,7 @@
};
nixpkgs.follows = "haskellNix/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
pre-commit-hooks = {
url = "github:cachix/pre-commit-hooks.nix";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
};
pre-commit-hooks.url = "github:cachix/git-hooks.nix";

# for Ormolu Live
ghc-wasm-meta.url = "gitlab:ghc/ghc-wasm-meta?host=gitlab.haskell.org";
Expand Down Expand Up @@ -119,6 +115,7 @@
pre-commit-check = inputs.pre-commit-hooks.lib.${system}.run {
src = ./.;
hooks = {
cabal-gild.enable = true;
nixpkgs-fmt.enable = true;
deadnix.enable = true;
purs-tidy.enable = true;
Expand Down Expand Up @@ -150,7 +147,6 @@
name = "ormolu-format";
text = builtins.readFile ./nix/format.sh;
runtimeInputs = [
(defaultGHC.dev.hsPkgs.tool "cabal" "latest")
defaultGHC.ormolu
];
};
Expand All @@ -165,6 +161,7 @@
configureArgs = "--disable-benchmarks --disable-tests";
};
};
nativeBuildInputs = pre-commit-check.enabledPackages;
withHoogle = false;
exactDeps = false;
inherit (pre-commit-check) shellHook;
Expand Down
4 changes: 0 additions & 4 deletions nix/format.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@

export LANG="C.UTF-8"

cabal format
(cd extract-hackage-info && cabal format)
(cd ormolu-live && cabal format)

export dirs="src app tests extract-hackage-info/src ormolu-live/app"
# shellcheck disable=SC2046,SC2086
ormolu -m inplace $(find $dirs -type f -name "*.hs" -o -name "*.hs-boot")

0 comments on commit ca45fef

Please sign in to comment.