diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2012-03-27 11:16:43 +0200 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2012-03-27 11:16:43 +0200 |
commit | 3e94ffffd61573624883c02744f20ac3544ff9cb (patch) | |
tree | 8de5543155086d462ac8575b144cf7dcd633eb3e /scripts/nix-build.in | |
parent | 446b827baedde7ba3ca44f9ef51940e28e13fb87 (diff) | |
download | guix-3e94ffffd61573624883c02744f20ac3544ff9cb.tar.gz |
Allow the command executed by "nix-build --run-env" to be overriden with --command
Diffstat (limited to 'scripts/nix-build.in')
-rwxr-xr-x | scripts/nix-build.in | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/scripts/nix-build.in b/scripts/nix-build.in index b36ec0208b..cc80089fb6 100755 --- a/scripts/nix-build.in +++ b/scripts/nix-build.in @@ -14,6 +14,8 @@ my @instArgs = (); my @buildArgs = (); my @exprs = (); +my $envCommand = "p=\$PATH; source \$stdenv/setup; PATH=\$PATH:\$p; exec $ENV{SHELL}"; + my $tmpDir = tempdir("nix-build.XXXXXX", CLEANUP => 1, TMPDIR => 1) or die "cannot create a temporary directory"; @@ -125,6 +127,12 @@ EOF $runEnv = 1; } + elsif ($arg eq "--command") { + $n++; + die "$0: `$arg' requires an argument\n" unless $n < scalar @ARGV; + $envCommand = $ARGV[$n]; + } + elsif (substr($arg, 0, 1) eq "-") { push @buildArgs, $arg; } @@ -168,7 +176,7 @@ foreach my $expr (@exprs) { # convenience, source $stdenv/setup to setup additional # environment variables. Also don't lose the current $PATH # directories. - exec($ENV{SHELL}, "-c", "p=\$PATH; source \$stdenv/setup; PATH=\$PATH:\$p; exec $ENV{SHELL}"); + exec($ENV{SHELL}, "-c", $envCommand); die; } |