-
Notifications
You must be signed in to change notification settings - Fork 159
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
19: Use the module system r=roberth a=roberth Closes #2 Closes #17 TODO - [x] ~expose and test "core" module set from project.nix~ - [x] ~niv update -b master project.nix when that's done (hercules-ci/project.nix#10 - [x] changelog entry: (elaborate on) translate `.pre-commit-config.yaml` to hooks argument - [x] update README - [x] add how to add a hook to README New - Selectively enable tools (#2) - Make choice of tool versions overridable - User-definable hooks - Input validation at the Nix level - Use gitignore by default Fixes - Stop installing files all over the place when doing nix-shell ../some-project to borrow a tool - Lorri support Cleanup - Get rid of some installation code Co-authored-by: Robert Hensing <[email protected]>
- Loading branch information
Showing
11 changed files
with
530 additions
and
142 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,18 @@ | ||
repos: | ||
- repo: .pre-commit-hooks/ | ||
rev: master | ||
hooks: | ||
- id: shellcheck | ||
- id: canonix | ||
# DO NOT MODIFY | ||
# This file was generated by nix-pre-commit-hooks | ||
{ | ||
"repos": [ | ||
{ | ||
"hooks": [ | ||
{ | ||
"id": "canonix" | ||
}, | ||
{ | ||
"id": "shellcheck" | ||
} | ||
], | ||
"repo": ".pre-commit-hooks/", | ||
"rev": "master" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Changelog | ||
|
||
All notable changes to this project will be documented in this file. | ||
|
||
The format is loosely based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) | ||
and is a rolling release. | ||
|
||
## 2019-10-02 | ||
|
||
### Added | ||
|
||
- The `run` derivation now uses [gitignore](https://github.com/hercules-ci/gitignore#readme) | ||
|
||
- Custom hooks can now be added | ||
|
||
### Changed | ||
|
||
- Hooks configuration is now module-based (using the module system, like NixOS). | ||
`.pre-commit-config.yaml` is now obsolete with `nix-pre-commit-hooks`. Translate it to the `hooks` argument. For example: | ||
|
||
``` | ||
pre-commit-check = nix-pre-commit-hooks.run { | ||
src = ./.; | ||
hooks = { | ||
elm-format.enable = true; | ||
ormolu.enable = true; | ||
shellcheck.enable = true; | ||
}; | ||
}; | ||
``` | ||
|
||
### Fixed | ||
|
||
- Some small improvements to the installation script (`shellHook`) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
imports = | ||
[ | ||
./pre-commit.nix | ||
./hooks.nix | ||
]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
{ config, lib, pkgs, ... }: | ||
let | ||
inherit (config.pre-commit) tools; | ||
in { | ||
config.pre-commit.hooks = | ||
{ | ||
hlint = | ||
{ | ||
name = "hlint"; | ||
description = | ||
"HLint gives suggestions on how to improve your source code."; | ||
entry = "${tools.hlint}/bin/hlint"; | ||
files = "\\.l?hs$"; | ||
}; | ||
ormolu = | ||
{ | ||
name = "ormolu"; | ||
description = "Haskell code prettifier."; | ||
entry = "${tools.ormolu}/bin/ormolu --mode inplace"; | ||
files = "\\.l?hs$"; | ||
}; | ||
hindent = | ||
{ | ||
name = "hindent"; | ||
description = "Haskell code prettifier."; | ||
entry = "${tools.hindent}/bin/hindent"; | ||
files = "\\.l?hs$"; | ||
}; | ||
cabal-fmt = | ||
{ | ||
name = "cabal-fmt"; | ||
description = "Format Cabal files"; | ||
entry = "${tools.cabal-fmt}/bin/cabal-fmt --inplace"; | ||
files = "\\.cabal$"; | ||
}; | ||
canonix = | ||
{ | ||
name = "canonix"; | ||
description = "Nix code prettifier."; | ||
entry = "${tools.canonix}/bin/canonix"; | ||
files = "\\.nix$"; | ||
}; | ||
nixfmt = | ||
{ | ||
name = "nixfmt"; | ||
description = "Nix code prettifier."; | ||
entry = "${tools.nixfmt}/bin/nixfmt"; | ||
files = "\\.nix$"; | ||
}; | ||
nixpkgs-fmt = | ||
{ | ||
name = "nixpkgs-fmt"; | ||
description = "Nix code prettifier."; | ||
entry = "${tools.nixpkgs-fmt}/bin/nixpkgs-fmt -i"; | ||
files = "\\.nix$"; | ||
}; | ||
elm-format = | ||
{ | ||
name = "elm-format"; | ||
description = "Format Elm files"; | ||
entry = | ||
"${tools.elm-format}/bin/elm-format --yes --elm-version=0.19"; | ||
files = "\\.elm$"; | ||
}; | ||
shellcheck = | ||
{ | ||
name = "shellcheck"; | ||
description = "Format shell files"; | ||
types = | ||
[ | ||
"bash" | ||
]; | ||
entry = "${tools.shellcheck}/bin/shellcheck"; | ||
}; | ||
terraform-format = | ||
{ | ||
name = "terraform-format"; | ||
description = "Format terraform (.tf) files"; | ||
entry = "${tools.terraform-fmt}/bin/terraform-fmt"; | ||
files = "\\.tf$"; | ||
}; | ||
}; | ||
} |
Oops, something went wrong.