`@var@' in the file `src', writing the result to $out, where `var' is any environment variable starting with a lowercase character. Example: genericSubstituter { src = ./file; foo = "bla"; shell = bash + "/bin/sh"; }; will replace `@foo@' with `bla' and `@shell@' with `/nix/store/...-bash-.../bin/sh'. svn path=/nixpkgs/trunk/; revision=6928
17 lines
355 B
Bash
17 lines
355 B
Bash
source $stdenv/setup
|
|
source $substitute
|
|
|
|
args=
|
|
|
|
# Select all environment variables that start with a lowercase character.
|
|
for envVar in $(env | sed "s/^[^a-z].*//" | sed "s/^\([^=]*\)=.*/\1/"); do
|
|
echo "$envVar -> ${!envVar}"
|
|
args="$args --subst-var $envVar"
|
|
done
|
|
|
|
substitute $src $out $args
|
|
|
|
if test -n "$isExecutable"; then
|
|
chmod +x $out
|
|
fi
|