Improve dev tools in the Nix environment (#1666)
* Improve dev tools in the nix environment Added postgrest-build, postgrest-run, postgrest-clean, postgrest-check and postgrest-watch tools. Changed order of postgrest-test-spec-all to run backwards from pg13 to pg9.5. Added shellcheck to lint shell scripts in nix environment. Co-authored-by: monacoremo <monacoremo>
This commit is contained in:
co-authored by
monacoremo <monacoremo>
parent
9adec12a67
commit
07cb47e6ac
@@ -0,0 +1,49 @@
|
||||
{ buildEnv
|
||||
, checkedShellScript
|
||||
, git
|
||||
, hlint
|
||||
, nixpkgs-fmt
|
||||
, silver-searcher
|
||||
, stylish-haskell
|
||||
}:
|
||||
let
|
||||
style =
|
||||
checkedShellScript "postgrest-style"
|
||||
''
|
||||
rootdir="$(${git}/bin/git rev-parse --show-toplevel)"
|
||||
|
||||
# Format Nix files
|
||||
${nixpkgs-fmt}/bin/nixpkgs-fmt "$rootdir" > /dev/null 2> /dev/null
|
||||
|
||||
# Format Haskell files
|
||||
${silver-searcher}/bin/ag -l -g '\.l?hs$' . "$rootdir" \
|
||||
| xargs ${stylish-haskell}/bin/stylish-haskell -i
|
||||
'';
|
||||
|
||||
# Script to check whether any uncommited changes result from postgrest-style
|
||||
styleCheck =
|
||||
checkedShellScript "postgrest-style-check"
|
||||
''
|
||||
${style}
|
||||
|
||||
${git}/bin/git diff-index --exit-code HEAD -- '*.hs' '*.lhs' '*.nix'
|
||||
'';
|
||||
|
||||
lint =
|
||||
checkedShellScript "postgrest-lint"
|
||||
''
|
||||
rootdir="$(${git}/bin/git rev-parse --show-toplevel)"
|
||||
|
||||
# Lint Haskell files
|
||||
${silver-searcher}/bin/ag -l -g '\.l?hs$' "$rootdir" \
|
||||
| xargs ${hlint}/bin/hlint -X QuasiQuotes -X NoPatternSynonyms
|
||||
'';
|
||||
in
|
||||
buildEnv {
|
||||
name = "postgrest-devtools";
|
||||
paths = [
|
||||
style.bin
|
||||
styleCheck.bin
|
||||
lint.bin
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user