blob: 060cdf6a58bb6f016b0d8f171951d0536bb161c5 [file] [log] [blame]
{
config,
lib,
pkgs,
...
}:
{
options.chimera.shell = {
rebuildFlakePath = lib.mkOption {
type = lib.types.nullOr lib.types.str;
description = "Full path to where you store your flake locally";
default = null;
};
defaultAliases.enable = lib.mkEnableOption "Use sensible custom aliases";
usefulPackages.enable = lib.mkEnableOption "Enable useful shell packages (ripgrep, wget, etc)";
replacements = {
defaultEnable = lib.mkEnableOption "Enable replacing everything by default";
eza.enable = lib.mkOption {
description = "Use eza instead of ls";
type = lib.types.bool;
default = config.chimera.shell.replacements.defaultEnable;
example = true;
};
bfs.enable = lib.mkOption {
description = "Use bfs instead of find";
type = lib.types.bool;
default = config.chimera.shell.replacements.defaultEnable;
example = true;
};
ripgrep.enable = lib.mkOption {
description = "Use ripgrep instead of grep";
type = lib.types.bool;
default = config.chimera.shell.replacements.defaultEnable;
example = true;
};
htop.enable = lib.mkOption {
description = "Use htop instead of top";
type = lib.types.bool;
default = config.chimera.shell.replacements.defaultEnable;
example = true;
};
erdtree.enable = lib.mkOption {
description = "Use erdtree instead of tree";
type = lib.types.bool;
default = config.chimera.shell.replacements.defaultEnable;
example = true;
};
dust.enable = lib.mkOption {
description = "Use dust instead of du";
type = lib.types.bool;
default = config.chimera.shell.replacements.defaultEnable;
example = true;
};
bat.enable = lib.mkOption {
description = "Use bat instead of cat";
type = lib.types.bool;
default = config.chimera.shell.replacements.defaultEnable;
example = true;
};
zoxide.enable = lib.mkOption {
description = "Use zoxide instead of cd";
type = lib.types.bool;
default = config.chimera.shell.replacements.defaultEnable;
example = true;
};
};
};
config = {
home.shellAliases = lib.mkIf config.chimera.shell.defaultAliases.enable {
rebuild =
lib.mkIf (config.chimera.shell.rebuildFlakePath != null)
"sudo nixos-rebuild switch --flake ${config.chimera.shell.rebuildFlakePath}";
clr = "clear";
edit = config.home.sessionVariables.EDITOR;
find = lib.mkIf config.chimera.shell.replacements.bfs.enable "${pkgs.bfs}/bin/bfs";
grep = lib.mkIf config.chimera.shell.replacements.ripgrep.enable "${config.programs.ripgrep.package}/bin/rg";
top = lib.mkIf config.chimera.shell.replacements.htop.enable "${config.programs.htop.package}/bin/htop";
tree = lib.mkIf config.chimera.shell.replacements.erdtree.enable "${pkgs.erdtree}/bin/erdtree";
du = lib.mkIf config.chimera.shell.replacements.dust.enable "${pkgs.dust}/bin/dust";
cat = lib.mkIf config.chimera.shell.replacements.bat.enable "${pkgs.bat}/bin/bat";
};
programs.eza = lib.mkIf config.chimera.shell.replacements.eza.enable {
enable = true;
enableAliases = true;
};
programs.ripgrep = lib.mkIf config.chimera.shell.replacements.ripgrep.enable {
enable = true;
arguments = [ "--smart-case" ];
};
programs.htop = lib.mkIf config.chimera.shell.replacements.htop.enable { enable = true; };
programs.zoxide = lib.mkIf config.chimera.shell.replacements.zoxide.enable {
enable = true;
enableZshIntegration = config.chimera.shell.zsh.enable;
enableBashIntegration = config.chimera.shell.bash.enable;
options = [ "--cmd cd" ];
};
programs.tealdeer = lib.mkIf config.chimera.shell.usefulPackages.enable {
enable = true;
settings.updates = {
auto_update = true;
auto_update_interval_hours = 72;
};
};
programs.jq = lib.mkIf config.chimera.shell.usefulPackages.enable { enable = true; };
home.packages =
(
if config.chimera.shell.usefulPackages.enable then
[
pkgs.wget
pkgs.curl
pkgs.curlie
pkgs.pv
pkgs.sd
pkgs.tokei
pkgs.hyperfine
pkgs.tmux
]
else
[ ]
)
++ (if config.chimera.shell.replacements.bfs.enable then [ pkgs.bfs ] else [ ])
++ (if config.chimera.shell.replacements.htop.enable then [ pkgs.htop ] else [ ])
++ (if config.chimera.shell.replacements.erdtree.enable then [ pkgs.erdtree ] else [ ])
++ (if config.chimera.shell.replacements.dust.enable then [ pkgs.dust ] else [ ])
++ (if config.chimera.shell.replacements.bat.enable then [ pkgs.bat ] else [ ]);
};
}