Files
NixOS/modules/shell/tools.nix
Danilo Reyes cbe7c25812 Add multi-user support for various applications and services
Enhanced the configuration files to support multi-user management by introducing user options for multiple applications, including art, gaming, multimedia, and development tools. Updated existing modules to utilize these new user options, improving flexibility and maintainability in user package installations.
2026-01-16 13:07:56 -06:00

132 lines
4.0 KiB
Nix

{
config,
lib,
pkgs,
inputs,
...
}:
let
shellType = config.my.shell.type;
in
{
options.my.shell.tools = {
enable = lib.mkEnableOption "shell tools and utilities";
users = lib.mkOption {
type = lib.types.either lib.types.str (lib.types.listOf lib.types.str);
default = config.my.toggleUsers.shell;
description = "Users to install shell tools for";
};
};
config = lib.mkIf config.my.shell.tools.enable {
home-manager.users = inputs.self.lib.mkHomeManagerUsers lib config.my.shell.tools.users (user: {
programs = {
hstr.enable = true;
htop = {
enable = true;
package = pkgs.htop-vim;
};
eza = {
enable = true;
git = true;
icons = "auto";
};
zoxide = {
enable = true;
enableBashIntegration = shellType == "bash";
enableZshIntegration = shellType == "zsh";
};
bat = {
enable = true;
config.pager = "less -FR";
extraPackages = builtins.attrValues {
inherit (pkgs.bat-extras)
batman # man pages
batpipe # piping
batgrep # ripgrep
batdiff # this is getting crazy!
batwatch # probably my next best friend
prettybat # trans your sourcecode!
;
};
};
password-store = {
enable = false;
package = pkgs.gopass;
settings = {
PASSWORD_STORE_AUTOCLIP = "true";
PASSWORD_STORE_AUTOIMPORT = "false";
PASSWORD_STORE_CLIPTIMEOUT = "45";
PASSWORD_STORE_EXPORTKEYS = "false";
PASSWORD_STORE_NOPAGER = "false";
PASSWORD_STORE_NOTIFICATIONS = "false";
PASSWORD_STORE_PARSING = "true";
PASSWORD_STORE_PATH = "/home/${user}/.local/share/pass";
PASSWORD_STORE_SAFECONTENT = "true";
};
};
${shellType} = {
shellAliases = inputs.self.lib.mergeAliases inputs.self.lib.commonAliases {
cd = "z";
hh = "hstr";
ls = "eza --icons --group-directories-first";
rm = "trash";
b = "bat";
f = "fzf --multi --exact -i";
unique-extensions = ''
fd -tf | rev | cut -d. -f1 | rev |
tr '[:upper:]' '[:lower:]' | sort |
uniq --count | sort -rn'';
};
}
//
inputs.self.lib.shellConditional shellType
''
if command -v fzf-share >/dev/null; then
source "$(fzf-share)/key-bindings.bash"
source "$(fzf-share)/completion.bash"
fi
''
''
if command -v fzf-share >/dev/null; then
source "$(fzf-share)/key-bindings.bash"
source "$(fzf-share)/completion.bash"
fi
'';
};
});
programs = {
starship.enable = true;
tmux.enable = true;
fzf.fuzzyCompletion = true;
neovim = {
enable = true;
vimAlias = true;
};
};
users.users =
let
packages = builtins.attrValues {
inherit (pkgs)
ripgrep # modern grep
dust # rusty du similar to gdu
fd # modern find, faster searches
fzf # fuzzy finder! super cool and useful
gdu # disk-space utility checker, somewhat useful
tealdeer # man for retards
trash-cli # oop! did not meant to delete that
jq # json parser
yq # yaml parser
smartmontools # check hard drie health
rmlint # amazing dupe finder that integrates well with BTRFS
;
};
in
inputs.self.lib.mkUserPackages lib config.my.shell.tools.users packages;
environment.variables = {
HISTFILE = "\${XDG_STATE_HOME}/bash/history";
LESSHISTFILE = "-";
RIPGREP_CONFIG_PATH = "\${XDG_CONFIG_HOME}/ripgrep/ripgreprc";
};
};
}