aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/nix-build.in10
1 files changed, 9 insertions, 1 deletions
diff --git a/scripts/nix-build.in b/scripts/nix-build.in
index cc80089fb..9e051101c 100755
--- a/scripts/nix-build.in
+++ b/scripts/nix-build.in
@@ -15,6 +15,7 @@ my @buildArgs = ();
my @exprs = ();
my $envCommand = "p=\$PATH; source \$stdenv/setup; PATH=\$PATH:\$p; exec $ENV{SHELL}";
+my @envExclude = ();
my $tmpDir = tempdir("nix-build.XXXXXX", CLEANUP => 1, TMPDIR => 1)
@@ -133,6 +134,12 @@ EOF
$envCommand = $ARGV[$n];
}
+ elsif ($arg eq "--exclude") {
+ $n++;
+ die "$0: `$arg' requires an argument\n" unless $n < scalar @ARGV;
+ push @envExclude, $ARGV[$n];
+ }
+
elsif (substr($arg, 0, 1) eq "-") {
push @buildArgs, $arg;
}
@@ -163,7 +170,8 @@ foreach my $expr (@exprs) {
my $drv = derivationFromPath($drvPath);
# Build or fetch all dependencies of the derivation.
- system("$Nix::Config::binDir/nix-store -r @buildArgs @{$drv->{inputDrvs}} @{$drv->{inputSrcs}} > /dev/null") == 0
+ my @inputDrvs = grep { my $x = $_; (grep { $x =~ $_ } @envExclude) == 0 } @{$drv->{inputDrvs}};
+ system("$Nix::Config::binDir/nix-store -r @buildArgs @inputDrvs @{$drv->{inputSrcs}} > /dev/null") == 0
or die "$0: failed to build all dependencies\n";
# Set the environment.