2023-12-17 05:59:09 +00:00
|
|
|
{ config, pkgs, lib, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.custom-hm.fish;
|
|
|
|
in
|
|
|
|
{
|
2023-12-24 10:53:47 +00:00
|
|
|
options.custom-hm.fish = {
|
2023-12-17 05:59:09 +00:00
|
|
|
enable = mkEnableOption "fish";
|
|
|
|
plugins = mkOption {
|
|
|
|
type = types.listOf types.str;
|
2024-01-07 13:41:01 +00:00
|
|
|
default = [ "pisces" "done" "hydro" "grc" ];
|
2023-12-17 05:59:09 +00:00
|
|
|
};
|
|
|
|
functions = {
|
|
|
|
enable = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
alias = {
|
|
|
|
enable = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2024-01-07 13:41:01 +00:00
|
|
|
config = mkIf cfg.enable {
|
|
|
|
home.packages = [ pkgs.grc ];
|
|
|
|
programs.fish = {
|
2023-12-17 05:59:09 +00:00
|
|
|
enable = true;
|
2024-01-07 13:41:01 +00:00
|
|
|
plugins = with pkgs; (filter (
|
2023-12-24 10:53:47 +00:00
|
|
|
e: hasAttr e.name (builtins.listToAttrs # { "xxx" = true; }
|
2023-12-17 05:59:09 +00:00
|
|
|
(map (p: { name = p; value = true; }) cfg.plugins) # { name = "xxx"; value = true; }
|
2023-12-24 10:53:47 +00:00
|
|
|
)) [
|
2024-01-07 13:41:01 +00:00
|
|
|
{ name = "pisces";
|
2023-12-17 05:59:09 +00:00
|
|
|
src = fishPlugins.pisces.src;
|
|
|
|
}
|
2024-01-07 13:41:01 +00:00
|
|
|
{ name = "done";
|
2023-12-17 05:59:09 +00:00
|
|
|
src = fishPlugins.done.src;
|
|
|
|
}
|
2024-01-07 13:41:01 +00:00
|
|
|
{ name = "hydro";
|
2023-12-17 05:59:09 +00:00
|
|
|
src = fishPlugins.hydro.src;
|
|
|
|
}
|
2024-01-07 13:41:01 +00:00
|
|
|
{ name = "grc";
|
|
|
|
src = fishPlugins.grc.src;
|
|
|
|
}
|
|
|
|
]);
|
2023-12-17 05:59:09 +00:00
|
|
|
interactiveShellInit = let
|
|
|
|
extraInit = if cfg.functions.enable then ''
|
|
|
|
${pkgs.nix-your-shell}/bin/nix-your-shell fish | source
|
|
|
|
function fish_right_prompt
|
|
|
|
if test -n "$IN_NIX_SHELL"
|
|
|
|
echo -n "<nix-shell>"
|
|
|
|
else if test $SHLVL -ge 3
|
|
|
|
echo -n "<🚀lv$SHLVL>"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
function fish_command_not_found
|
|
|
|
${pkgs.comma}/bin/comma $argv
|
|
|
|
end
|
|
|
|
'' else "";
|
|
|
|
in ''
|
|
|
|
fish_config prompt choose arrow
|
|
|
|
'' + extraInit;
|
|
|
|
functions = mkIf cfg.functions.enable {
|
|
|
|
gitignore = "curl -sL https://www.gitignore.io/api/$argv";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|