Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Format .cabal files with cabal-gild #1130

Merged
merged 3 commits into from
Jul 10, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Format .cabal files with cabal-gild
  • Loading branch information
amesgen committed Jul 9, 2024
commit ca45fef29302c7942886872e47496ef077c7cf3f
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -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
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
@@ -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";
@@ -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;
@@ -150,7 +147,6 @@
name = "ormolu-format";
text = builtins.readFile ./nix/format.sh;
runtimeInputs = [
(defaultGHC.dev.hsPkgs.tool "cabal" "latest")
defaultGHC.ormolu
];
};
@@ -165,6 +161,7 @@
configureArgs = "--disable-benchmarks --disable-tests";
};
};
nativeBuildInputs = pre-commit-check.enabledPackages;
withHoogle = false;
exactDeps = false;
inherit (pre-commit-check) shellHook;
4 changes: 0 additions & 4 deletions nix/format.sh
Original file line number Diff line number Diff line change
@@ -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")