blob: f03ad77989fc3b0ec94a1c4de8015f9149e55826 [file] [log] [blame]
Samuel Shuert02ffd1e2024-02-13 21:37:15 -05001{
2 config,
3 lib,
4 pkgs,
5 ...
6}:
7{
8 options.chimera.shell = {
9 rebuildFlakePath = lib.mkOption {
10 type = lib.types.nullOr lib.types.str;
11 description = "Full path to where you store your flake locally";
12 default = null;
13 };
14 defaultAliases.enable = lib.mkEnableOption "Use sensible custom aliases";
15 usefulPackages.enable = lib.mkEnableOption "Enable useful shell packages (ripgrep, wget, etc)";
16 replacements = {
17 eza.enable = lib.mkEnableOption "Use eza instead of ls";
18 bfs.enable = lib.mkEnableOption "Use bfs instead of find";
19 ripgrep.enable = lib.mkEnableOption "Use ripgrep instead of grep";
20 htop.enable = lib.mkEnableOption "Use htop instead of top";
21 erdtree.enable = lib.mkEnableOption "Use erdtree instead of tree";
22 dust.enable = lib.mkEnableOption "Use dust instead of du";
23 bat.enable = lib.mkEnableOption "Use bat instead of cat";
24 };
25 };
26
27 config = {
28 home.shellAliases = lib.mkIf config.chimera.shell.defaultAliases.enable {
29 rebuild =
30 lib.mkIf (config.chimera.shell.rebuildFlakePath != null)
31 "sudo nixos-rebuild switch --flake ${config.chimera.shell.rebuildFlakePath}";
32 clr = "clear";
33 edit = config.home.sessionVariables.EDITOR;
34 };
35
36 programs = lib.mkIf config.chimera.shell.usefulPackages.enable {
37 tealdeer = {
38 enable = true;
39 settings.updates.autoupdate = true;
40 };
41 jq.enable = true;
42 };
43
44 home.packages =
45 (
46 if config.chimera.shell.usefulPackages.enable then
47 [
48 pkgs.wget
49 pkgs.curl
50 pkgs.curlie
51 pkgs.pv
52 pkgs.sd
53 pkgs.tokei
54 pkgs.hyperfine
55 ]
56 else
57 [ ]
58 )
59 ++ (if config.chimera.shell.replacements.eza.enable then [ pkgs.eza ] else [ ])
60 ++ (if config.chimera.shell.replacements.bfs.enable then [ pkgs.bfs ] else [ ])
61 ++ (if config.chimera.shell.replacements.ripgrep.enable then [ pkgs.ripgrep ] else [ ])
62 ++ (if config.chimera.shell.replacements.htop.enable then [ pkgs.htop ] else [ ])
63 ++ (if config.chimera.shell.replacements.erdtree.enable then [ pkgs.erdtree ] else [ ])
64 ++ (if config.chimera.shell.replacements.dust.enable then [ pkgs.dust ] else [ ])
65 ++ (if config.chimera.shell.replacements.bat.enable then [ pkgs.bat ] else [ ]);
66 };
67}