File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11let
2+ # Use nixpkgs available on the system
23 pkgs = import <nixpkgs> { } ;
4+ haskellDependencies = with pkgs . haskellPackages ; [
5+ stack
6+ cabal-install
7+ haskell-language-server
8+ hlint
9+ ghcid
10+ hpack
11+ ] ;
12+
13+ # Build a Haskell package with those dependencies
14+ addBuildTools = pkgs . haskell . lib . addBuildTools ;
315 package = pkgs . haskellPackages . developPackage {
416 root = ./. ;
5- modifier = drv :
6- pkgs . haskell . lib . addBuildTools drv ( with pkgs . haskellPackages ; [
7- stack
8- cabal-install
9- haskell-language-server
10- hlint
11- ghcid
12- hpack
13- ] ) ;
17+ modifier = drv : addBuildTools drv haskellDependencies ;
1418 } ;
15- in
16- package . overrideAttrs ( old : {
19+
20+ # Extend the build environment with pre-commit installed and activated
21+ withPreCommitHook = old : {
1722 nativeBuildInputs = ( old . nativeBuildInputs or [ ] ) ++ [ pkgs . pre-commit ] ;
1823 shellHook = ( old . shellHook or "" ) + ''
1924 if [ -d .git ]; then
2025 pre-commit install --hook-type pre-push
2126 fi
2227 '' ;
23- } )
28+ } ;
29+ in
30+ package . overrideAttrs withPreCommitHook
You can’t perform that action at this time.
0 commit comments