summary refs log tree commit diff
path: root/nixos/modules/programs/command-not-found/command-not-found.pl
diff options
context:
space:
mode:
Diffstat (limited to 'nixos/modules/programs/command-not-found/command-not-found.pl')
-rw-r--r--nixos/modules/programs/command-not-found/command-not-found.pl3
1 files changed, 3 insertions, 0 deletions
diff --git a/nixos/modules/programs/command-not-found/command-not-found.pl b/nixos/modules/programs/command-not-found/command-not-found.pl
index b233d973a4ab..5bdda26592e6 100644
--- a/nixos/modules/programs/command-not-found/command-not-found.pl
+++ b/nixos/modules/programs/command-not-found/command-not-found.pl
@@ -3,6 +3,7 @@
 use strict;
 use DBI;
 use DBD::SQLite;
+use String::ShellQuote;
 use Config;
 
 my $program = $ARGV[0];
@@ -31,6 +32,8 @@ 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));
     } else {
         print STDERR <<EOF;
 The program ‘$program’ is currently not installed. You can install it by typing: