diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2013-07-19T10·02+0200 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2013-07-19T10·02+0200 |
commit | 2bc5de86357fddcc52e2ce0c1b432a9509dea27e (patch) | |
tree | 9148dd78fd736d402facad808b7236445c007cb5 /scripts | |
parent | dc5f2e7da607bdf50bf710cbe0b5f6ff32980e19 (diff) |
Rename ‘nix-build --run-env’ to ‘nix-shell’
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/Makefile.am | 1 | ||||
-rwxr-xr-x | scripts/nix-build.in | 16 |
2 files changed, 10 insertions, 7 deletions
diff --git a/scripts/Makefile.am b/scripts/Makefile.am index 1453ed9cc1ac..d9f39aad1b4f 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -18,6 +18,7 @@ install-exec-local: download-using-manifests.pl copy-from-other-stores.pl downlo $(INSTALL) -d $(DESTDIR)$(libexecdir)/nix/substituters $(INSTALL_PROGRAM) download-using-manifests.pl copy-from-other-stores.pl download-from-binary-cache.pl $(DESTDIR)$(libexecdir)/nix/substituters $(INSTALL) -d $(DESTDIR)$(sysconfdir)/nix + ln -sf nix-build $(DESTDIR)$(bindir)/nix-shell include ../substitute.mk diff --git a/scripts/nix-build.in b/scripts/nix-build.in index 899882952b12..a7f23df41a1d 100755 --- a/scripts/nix-build.in +++ b/scripts/nix-build.in @@ -9,7 +9,7 @@ use File::Temp qw(tempdir); my $dryRun = 0; my $verbose = 0; -my $runEnv = 0; +my $runEnv = $0 =~ /nix-shell$/; my $pure = 0; my @instArgs = (); @@ -20,8 +20,10 @@ my $shell = $ENV{SHELL} || "/bin/sh"; my $envCommand = ""; # interactive shell my @envExclude = (); +my $myName = $runEnv ? "nix-shell" : "nix-build"; -my $tmpDir = tempdir("nix-build.XXXXXX", CLEANUP => 1, TMPDIR => 1) + +my $tmpDir = tempdir("$myName.XXXXXX", CLEANUP => 1, TMPDIR => 1) or die "cannot create a temporary directory"; my $outLink = "./result"; @@ -35,11 +37,11 @@ for (my $n = 0; $n < scalar @ARGV; $n++) { my $arg = $ARGV[$n]; if ($arg eq "--help") { - exec "man nix-build" or die; + exec "man $myName" or die; } elsif ($arg eq "--version") { - print "nix-build (Nix) $Nix::Config::version\n"; + print "$myName (Nix) $Nix::Config::version\n"; exit 0; } @@ -119,7 +121,7 @@ for (my $n = 0; $n < scalar @ARGV; $n++) { push @instArgs, $arg; } - elsif ($arg eq "--run-env") { + elsif ($arg eq "--run-env") { # obsolete $runEnv = 1; } @@ -164,7 +166,7 @@ foreach my $expr (@exprs) { } if ($runEnv) { - die "$0: ‘--run-env’ requires a single derivation\n" if scalar @drvPaths != 1; + die "$0: a single derivation is required\n" if scalar @drvPaths != 1; my $drvPath = readlink $drvPaths[0] or die "cannot read symlink `$drvPaths[0]'"; my $drv = derivationFromPath($drvPath); @@ -197,7 +199,7 @@ foreach my $expr (@exprs) { '[ -e $stdenv/setup ] && source $stdenv/setup; ' . ($pure ? '' : 'PATH=$PATH:$p; ') . 'set +e; ' . - 'PS1="\n\[\033[1;32m\][nix-build:\w]$\[\033[0m\] "; ' . + 'PS1="\n\[\033[1;32m\][nix-shell:\w]$\[\033[0m\] "; ' . $envCommand); exec($ENV{NIX_BUILD_SHELL} // "bash", "--rcfile", $rcfile); die; |