File tree Expand file tree Collapse file tree 3 files changed +104
-0
lines changed Expand file tree Collapse file tree 3 files changed +104
-0
lines changed Original file line number Diff line number Diff line change 4747/* .vkey
4848/* .cert
4949
50+ .pre-commit-config.yaml
51+
5052# For now require that users generate their own hie.yaml
5153/hie.yaml
5254
Original file line number Diff line number Diff line change 1616 nixpkgs . url = "github:NixOS/nixpkgs/4284c2b73c8bce4b46a6adf23e16d9e2ec8da4bb" ;
1717 iohkNix . url = "github:input-output-hk/iohk-nix" ;
1818 flake-utils . url = "github:hamishmack/flake-utils/hkm/nested-hydraJobs" ;
19+ pre-commit-hooks . url = "github:cachix/git-hooks.nix" ;
1920 incl . url = "github:divnix/incl" ;
2021 # non-flake nix compatibility
2122 flake-compat = {
7778 proto-js-bundle-drv = import ./nix/proto-to-js.nix { pkgs = nixpkgs ; } ;
7879 wasm-typedoc-drv = import ./nix/typedoc.nix { pkgs = nixpkgs ; } ;
7980
81+ pre-commit-check = inputs . pre-commit-hooks . lib . ${ nixpkgs . system } . run {
82+ src = ./. ;
83+ hooks = {
84+ alejandra . enable = true ;
85+ cabal-gild = {
86+ enable = true ;
87+ entry = let
88+ script = nixpkgs . writeShellScript "precommit-cabal-gild" ''
89+ for file in "$@"; do
90+ cabal-gild --io="$file"
91+ done
92+ '' ;
93+ in
94+ builtins . toString script ;
95+ files = "\\ .cabal$" ;
96+ } ;
97+ prettify = {
98+ enable = true ;
99+ entry = "scripts/githooks/haskell-style-lint" ;
100+ types = [ "haskell" ] ;
101+ } ;
102+ } ;
103+ } ;
104+
80105 # We use cabalProject' to ensure we don't build the plan for
81106 # all systems.
82107 cabalProject = nixpkgs . haskell-nix . cabalProject' ( { config , ...} : {
104129 secure: True
105130 active-repositories: hackage.haskell.org, cardano-haskell-packages-local
106131 '' ;
132+
107133 shell . packages = p : [
108134 # Packages in this repo
109135 p . cardano-api
133159 # Skip cross compilers for the shell
134160 shell . crossPlatforms = _ : [ ] ;
135161 shell . shellHook = ''
162+ export PATH="${ nixpkgs . nix } /bin:$PATH"
163+ ${ pre-commit-check . shellHook }
136164 export LD_LIBRARY_PATH="${ nixpkgs . snappy } /lib:$LD_LIBRARY_PATH"
137165 export PATH="$(git rev-parse --show-toplevel)/scripts/devshell:$PATH"
138166 '' ;
You can’t perform that action at this time.
0 commit comments