mirror of
https://github.com/nix-community/home-manager
synced 2024-11-18 09:09:45 +01:00
3b799f6ea4
`nix-index` is a tool to quickly locate the package providing a certain file in `nixpkgs`. It indexes built derivations found in binary caches. This module adds the shell integration for its `command-not-found` script for interactive shells.
38 lines
1,022 B
Nix
38 lines
1,022 B
Nix
{ pkgs, ... }:
|
|
let
|
|
fishRegex = ''
|
|
function __fish_command_not_found_handler --on-event fish_command_not_found
|
|
/nix/store/.*command-not-found $argv
|
|
end
|
|
'';
|
|
in {
|
|
config = {
|
|
programs.bash.enable = true;
|
|
programs.fish.enable = true;
|
|
programs.zsh.enable = true;
|
|
|
|
nixpkgs.overlays =
|
|
[ (self: super: { zsh = pkgs.writeScriptBin "dummy-zsh" ""; }) ];
|
|
|
|
programs.nix-index.enable = true;
|
|
|
|
nmt.script = ''
|
|
# Bash integration
|
|
assertFileExists home-files/.bashrc
|
|
assertFileRegex \
|
|
home-files/.bashrc \
|
|
'source /nix/store/.*nix-index.*/etc/profile.d/command-not-found.sh'
|
|
|
|
# Zsh integration
|
|
assertFileExists home-files/.zshrc
|
|
assertFileRegex \
|
|
home-files/.zshrc \
|
|
'source /nix/store/.*nix-index.*/etc/profile.d/command-not-found.sh'
|
|
|
|
# Fish integration
|
|
assertFileExists home-files/.config/fish/config.fish
|
|
assertFileRegex \
|
|
home-files/.config/fish/config.fish '${fishRegex}'
|
|
'';
|
|
};
|
|
}
|