Skip to content

Commit 7abf2d6

Browse files
committed
Reduce help message verbosity if invoked by direnv
1 parent a2a0e7f commit 7abf2d6

File tree

1 file changed

+20
-10
lines changed

1 file changed

+20
-10
lines changed

flake.nix

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -86,16 +86,19 @@
8686
# FIXME This works on Ubuntu, may not on other distros. FIXME
8787
export LOCALE_ARCHIVE=/usr/lib/locale/locale-archive
8888
89-
export PS1='labenv(HiPEAC) (ibex-demo-system) \$ '
89+
if [ -z "$DIRENV_IN_ENVRC" ]; then
90+
export PS1='labenv(HiPEAC) (ibex-demo-system) \$ '
91+
92+
echo
93+
echo
94+
cat ./data/lowrisc.art
95+
fi
9096
91-
echo
92-
echo
93-
cat ./data/lowrisc.art
9497
echo "---------------------------------------------------"
9598
echo "Welcome to the 'ibex-demo-system' nix environment!"
9699
echo "---------------------------------------------------"
97100
98-
helpstr=$(cat <<'EOF'
101+
helpme(){ cat <<'EOF'
99102
100103
Build ibex software :
101104
mkdir sw/c/build && pushd sw/c/build && cmake ../ && make && popd
@@ -115,17 +118,24 @@
115118
Connect gdb to a running program on the FPGA (In a different terminal to the OpenOCD instance):
116119
riscv32-unknown-elf-gdb -ex "target extended-remote localhost:3333" ./sw/c/build/demo/hello_world/demo
117120
121+
EOF
122+
123+
if [ -z "$DIRENV_IN_ENVRC" ]; then
124+
cat <<'EOF'
118125
To leave the environment:
119126
exit
120127
121128
EOF
122-
)
123-
helpme(){ echo "$helpstr"; }
129+
fi
130+
}
131+
124132
helpme
125133
126-
echo
127-
echo "Run 'helpme' in your shell to see this message again."
128-
echo
134+
if [ -z "$DIRENV_IN_ENVRC" ]; then
135+
echo
136+
echo "Run 'helpme' in your shell to see this message again."
137+
echo
138+
fi
129139
'';
130140
};
131141
formatter = pkgs.alejandra;

0 commit comments

Comments
 (0)