How create or config script alias?

Hi, I’m trying to create an alias in bash to be able to use idx, but it doesn’t work.
I use bash $SHELL=bash

 onCreate = {
    install =''
# Alias
mkdir -p ~/.config/fish
echo "alias dc=\"docker compose\" ">> ~/.config/fish/config.fish
echo "alias dc=\"docker compose\" ">> ~/.bashrc
'';

onCreate only runs when the workspace is created first time, and then it will never run again.

You might just run the command echo "alias dc=\"docker compose\" ">> ~/.bashrc in your current terminal, but I’m not sure if everything outside of your workspace folder is resetted or deleted after some period of time.

i was looking to set aliases in nix awhile ago, but got distracted…
your post got me thinking,

dunno if this is kosher, but it works…

   onStart = {
android-timezone = ''adb -s localhost:5555 wait-for-device && adb -s localhost:5555 shell service call alarm 3 s16 $TZ '';
  onStart = ''
  echo -e "alias foo='echo hello world'" > /home/user/.bash_aliases
  echo -e "alias acl='adb connect localhost:5555'" >> /home/user/.bash_aliases
  '';     

};

1 Like