Files
postgrest/nix/devtools.nix
T
Remo RechkemmerGitHubmonacoremo <monacoremo>
07cb47e6ac 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>
2020-11-30 22:21:19 +01:00

60 lines
1.2 KiB
Nix

{ buildEnv
, cabal-install
, checkedShellScript
, devCabalOptions
, entr
, git
, silver-searcher
, style
, tests
}:
let
watch =
checkedShellScript "postgrest-watch"
''
rootdir="$(${git}/bin/git rev-parse --show-toplevel)"
${silver-searcher}/bin/ag -l . "$rootdir" | ${entr}/bin/entr -r "$@"
'';
pushCachix =
checkedShellScript "postgrest-push-cachix"
''
nix-store -qR --include-outputs "$(nix-instantiate)" \
| cachix push postgrest
'';
build =
checkedShellScript "postgrest-build"
''exec ${cabal-install}/bin/cabal v2-build ${devCabalOptions} "$@"'';
run =
checkedShellScript "postgrest-run"
''exec ${cabal-install}/bin/cabal v2-run postgrest ${devCabalOptions} -- "$@"'';
clean =
checkedShellScript "postgrest-clean"
''
${cabal-install}/bin/cabal v2-clean
'';
check =
checkedShellScript "postgrest-check"
''
${tests}/bin/postgrest-test-spec-all
${style}/bin/postgrest-lint
${style}/bin/postgrest-style-check
'';
in
buildEnv {
name = "postgrest-devtools";
paths = [
watch.bin
pushCachix.bin
build.bin
run.bin
clean.bin
check.bin
];
}