Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 18 additions & 6 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,16 @@
rust =
pkgs.rust-bin.fromRustupToolchainFile "${toString ./rust-toolchain.toml}";

aliases = ''
alias buildcmd='bash jump-start.sh && roc ./build.roc -- --roc roc'
alias testcmd='export ROC=roc && export EXAMPLES_DIR=./examples/ && ./ci/all_tests.sh'
shellFunctions = ''
buildcmd() {
bash jump-start.sh && roc ./build.roc -- --roc roc
}
export -f buildcmd

testcmd() {
export EXAMPLES_DIR=./examples/ && ./ci/all_tests.sh
}
export -f testcmd
'';

linuxInputs = with pkgs;
Expand Down Expand Up @@ -72,10 +79,15 @@
if pkgs.stdenv.isLinux then "${pkgs.glibc.out}/lib" else "";

shellHook = ''
${aliases}
export ROC=roc

${shellFunctions}

echo "Some convenient command aliases:"
echo "${aliases}" | grep -E "alias .*" -o | sed 's/alias / /' | sed 's/=/ = /'
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 ""
'';
};
Expand Down