3
0
Fork 0
forked from mirrors/nixpkgs

Merge pull request #140519 from lovesegfault/no-auto-install

command-not-found: remove NIX_AUTO_INSTALL
This commit is contained in:
Eelco Dolstra 2021-10-05 11:15:47 +02:00 committed by GitHub
commit f18bf9b9f1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -25,14 +25,7 @@ if (!defined $res || scalar @$res == 0) {
print STDERR "$program: command not found\n"; print STDERR "$program: command not found\n";
} elsif (scalar @$res == 1) { } elsif (scalar @$res == 1) {
my $package = @$res[0]->{package}; my $package = @$res[0]->{package};
if ($ENV{"NIX_AUTO_INSTALL"} // "") { if ($ENV{"NIX_AUTO_RUN"} // "") {
print STDERR <<EOF;
The program '$program' is currently not installed. It is provided by
the package '$package', which I will now install for you.
EOF
;
exit 126 if system("nix-env", "-iA", "nixos.$package") == 0;
} elsif ($ENV{"NIX_AUTO_RUN"} // "") {
exec("nix-shell", "-p", $package, "--run", shell_quote("exec", @ARGV)); exec("nix-shell", "-p", $package, "--run", shell_quote("exec", @ARGV));
} else { } else {
print STDERR <<EOF; print STDERR <<EOF;