Skip to content

Commit

Permalink
command-not-found: add xonsh integration
Browse files Browse the repository at this point in the history
  • Loading branch information
pasqui23 committed Dec 10, 2024
1 parent 92b0e27 commit f5b0284
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions modules/programs/command-not-found/command-not-found.nix
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,16 @@ in {
config = mkIf cfg.enable {
programs.bash.initExtra = shInit "command_not_found_handle";
programs.zsh.initExtra = shInit "command_not_found_handler";
programs.xonsh.xonshrc = ''
@events.on_command_not_found
def _command_not_found_nix(cmd):
import os.path
if os.path.isfile(${builtins.toJSON cfg.dbPath}):
${commandNotFound}/bin/command-not-found @(cmd)
else:
echo "$1: command not found" >&2
return 127
'';

home.packages = [ commandNotFound ];
};
Expand Down

0 comments on commit f5b0284

Please sign in to comment.