The way I can think of to do this is to make a program called cargo-build-env
which reads a file of your choosing with the features and executes cargo, then place that binary in your ~/.cargo/bin
directory. Then you can run cargo build-env
to build your program
The program can be in any language as long as it's executable, including shell script