From 0d1ef2568d2dc68bdec0ccdfbbf95f12f638a6a5 Mon Sep 17 00:00:00 2001 From: paki23 Date: Tue, 18 Jun 2024 22:31:22 +0200 Subject: [PATCH] command-not-found: add xonsh integration --- .../programs/command-not-found/command-not-found.nix | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/modules/programs/command-not-found/command-not-found.nix b/modules/programs/command-not-found/command-not-found.nix index f1a790235..a0f78a4f5 100644 --- a/modules/programs/command-not-found/command-not-found.nix +++ b/modules/programs/command-not-found/command-not-found.nix @@ -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 ]; };