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,43 @@
|
||||
# Create a bash script that is checked with shellcheck. You can either use it
|
||||
# directly, or use the .bin attribute to get the script in a bin/ directory,
|
||||
# to be used in a path for example.
|
||||
{ writeTextFile
|
||||
, runtimeShell
|
||||
, runCommand
|
||||
, stdenv
|
||||
, shellcheck
|
||||
}:
|
||||
name: text:
|
||||
let
|
||||
writeBin =
|
||||
name: text:
|
||||
writeTextFile {
|
||||
inherit name;
|
||||
executable = true;
|
||||
destination = "/bin/${name}";
|
||||
|
||||
text =
|
||||
''
|
||||
#!${runtimeShell}
|
||||
set -euo pipefail
|
||||
|
||||
${text}
|
||||
'';
|
||||
|
||||
checkPhase =
|
||||
''
|
||||
# check syntax
|
||||
${stdenv.shell} -n $out/bin/${name}
|
||||
|
||||
# check for shellcheck recommendations
|
||||
${shellcheck}/bin/shellcheck $out/bin/${name}
|
||||
'';
|
||||
};
|
||||
|
||||
bin =
|
||||
writeBin name text;
|
||||
|
||||
script =
|
||||
runCommand name { inherit bin name; } "ln -s $bin/bin/$name $out";
|
||||
in
|
||||
script // { inherit bin; }
|
||||
Reference in New Issue
Block a user