mirror of
https://github.com/roc-lang/roc.git
synced 2025-12-23 08:48:03 +00:00
better nix aliases
This commit is contained in:
parent
ba50f570c7
commit
a206f41247
1 changed files with 27 additions and 7 deletions
|
|
@ -22,12 +22,29 @@
|
|||
dependencies = (with pkgs; [
|
||||
zig
|
||||
zls
|
||||
git # for use in ci/zig_lints.sh
|
||||
]);
|
||||
|
||||
aliases = ''
|
||||
alias testcmd='zig build snapshot && zig build test'
|
||||
alias fmtcmd='zig build fmt'
|
||||
alias buildcmd='zig build roc'
|
||||
shellFunctions = ''
|
||||
buildcmd() {
|
||||
zig build roc
|
||||
}
|
||||
export -f buildcmd
|
||||
|
||||
testcmd() {
|
||||
zig build snapshot && zig build test
|
||||
}
|
||||
export -f testscmd
|
||||
|
||||
fmtcmd() {
|
||||
zig build fmt
|
||||
}
|
||||
export -f fmtcmd
|
||||
|
||||
cicmd() {
|
||||
zig build fmt && ./ci/zig_lints.sh && zig build && zig build snapshot && zig build test && zig build test-playground
|
||||
}
|
||||
export -f cicmd
|
||||
'';
|
||||
|
||||
in {
|
||||
|
|
@ -36,10 +53,13 @@
|
|||
buildInputs = dependencies;
|
||||
|
||||
shellHook = ''
|
||||
${aliases}
|
||||
${shellFunctions}
|
||||
|
||||
echo "Some convenient command aliases:"
|
||||
echo "${aliases}" | grep -E "alias .*" -o | sed 's/alias / /' | sort
|
||||
echo "Some convenient commands:"
|
||||
echo "${shellFunctions}" | grep -E '^\s*[a-zA-Z_][a-zA-Z0-9_]*\(\)' | sed 's/().*//' | sed 's/^[[:space:]]*/ /' | while read func; do
|
||||
body=$(echo "${shellFunctions}" | sed -n "/''${func}()/,/^[[:space:]]*}/p" | sed '1d;$d' | tr '\n' ';' | sed 's/;$//' | sed 's/[[:space:]]*$//')
|
||||
echo " $func = $body"
|
||||
done
|
||||
echo ""
|
||||
|
||||
unset NIX_CFLAGS_COMPILE
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue