blob: 89fa20fd48126fa3b3c4c6b04f4d823979d2d993 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
{
lib,
config,
pkgs,
...
}:
let
cfg = config.programs.comma;
in
{
options.programs.comma = {
enable = lib.mkEnableOption "comma";
package = lib.mkPackageOption pkgs "comma" { };
enableBashIntegration = lib.mkEnableOption "comma command-not-found handler for bash" // {
default = true;
};
enableZshIntegration = lib.mkEnableOption "comma command-not-found handler for zsh" // {
default = true;
};
enableFishIntegration = lib.mkEnableOption "comma command-not-found handler for fish" // {
default = true;
};
};
config = lib.mkIf cfg.enable {
environment.systemPackages = [ cfg.package ];
programs = {
bash.interactiveShellInit = lib.mkIf cfg.enableBashIntegration ''
source ${cfg.package}/share/comma/command-not-found.sh
'';
zsh.interactiveShellInit = lib.mkIf cfg.enableZshIntegration ''
source ${cfg.package}/share/comma/command-not-found.sh
'';
fish.interactiveShellInit = ''
source ${cfg.package}/share/comma/command-not-found.fish
'';
# Disable *other* command-not-found handlers
command-not-found.enable = lib.mkIf (
cfg.enableBashIntegration || cfg.enableZshIntegration || cfg.enableFishIntegration
) (lib.mkDefault false);
nix-index = {
enableBashIntegration = lib.mkIf (cfg.enableBashIntegration) (lib.mkDefault false);
enableZshIntegration = lib.mkIf (cfg.enableZshIntegration) (lib.mkDefault false);
enableFishIntegration = lib.mkIf (cfg.enableFishIntegration) (lib.mkDefault false);
};
};
};
meta.maintainers = with lib.maintainers; [ pandapip1 ];
}
|