Use nix-locate for command-not-found

This commit is contained in:
2022-05-16 15:01:15 -04:00
parent 63902fcb46
commit 9fc6f816fb
4 changed files with 72 additions and 6 deletions

View File

@@ -1,6 +1,8 @@
{ config, pkgs, ... }:
{
let
nix-locate = config.inputs.nix-locate.defaultPackage.${config.currentSystem};
in {
imports = [
./flakes.nix
./pia.nix
@@ -43,6 +45,7 @@
micro
helix
lm_sensors
nix-locate
];
nixpkgs.config.allowUnfree = true;
@@ -63,8 +66,25 @@
nix.gc.automatic = true;
programs.fish.enable = true;
programs.fish.shellInit = ''
set fish_greeting
'';
programs.command-not-found.enable = false;
programs.fish = {
enable = true;
shellInit = let
wrapper = pkgs.writeScript "command-not-found" ''
#!${pkgs.bash}/bin/bash
source ${nix-locate}/etc/profile.d/command-not-found.sh
command_not_found_handle "$@"
'';
in ''
# use nix-locate for command-not-found functionality
function __fish_command_not_found_handler --on-event fish_command_not_found
${wrapper} $argv
end
# disable annoying fish shell greeting
set fish_greeting
'';
};
}