forked from lix-project/lix
Allow the command executed by "nix-build --run-env" to be overriden with --command
This commit is contained in:
parent
446b827bae
commit
3e94ffffd6
|
@ -14,6 +14,8 @@ my @instArgs = ();
|
||||||
my @buildArgs = ();
|
my @buildArgs = ();
|
||||||
my @exprs = ();
|
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)
|
my $tmpDir = tempdir("nix-build.XXXXXX", CLEANUP => 1, TMPDIR => 1)
|
||||||
or die "cannot create a temporary directory";
|
or die "cannot create a temporary directory";
|
||||||
|
@ -125,6 +127,12 @@ EOF
|
||||||
$runEnv = 1;
|
$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 "-") {
|
elsif (substr($arg, 0, 1) eq "-") {
|
||||||
push @buildArgs, $arg;
|
push @buildArgs, $arg;
|
||||||
}
|
}
|
||||||
|
@ -168,7 +176,7 @@ foreach my $expr (@exprs) {
|
||||||
# convenience, source $stdenv/setup to setup additional
|
# convenience, source $stdenv/setup to setup additional
|
||||||
# environment variables. Also don't lose the current $PATH
|
# environment variables. Also don't lose the current $PATH
|
||||||
# directories.
|
# directories.
|
||||||
exec($ENV{SHELL}, "-c", "p=\$PATH; source \$stdenv/setup; PATH=\$PATH:\$p; exec $ENV{SHELL}");
|
exec($ENV{SHELL}, "-c", $envCommand);
|
||||||
die;
|
die;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue