Escaping @ in installPhase

I am trying to create a simple bash script that passes all arguments to python -m mitype <allargs>.
But nix interpretes @ as “installPhase” and my final script becomes this:

cd /nix/store/a75fybl3xlxy00fdk0q5g58bxj187izw-source
/nix/store/glfr70gi7hfaj50mwj2431p8bg60fhqw-python3-3.11.9/bin/python -m mitype "installPhase"
  installPhase = ''
    mkdir -p $out/bin
    echo "#!/usr/bin/env bash" > $out/bin/mitype
    echo "cd ${src}" >> $out/bin/mitype
    echo "${python3}/bin/python -m mitype \"$@\"" >> $out/bin/mitype
    chmod +x $out/bin/mitype

Ok. This works. Sorry for the noise.

    echo '${python3}/bin/python -m mitype $@' >> $out/bin/mitype

That will only work as long as the arguments do not contain spaces. The following should be reliable:

    echo '${python3}/bin/python -m mitype "$@"' >> $out/bin/mitype
1 Like