feat(home): extract CLI tools into modular home/base structure
- Add individual modules for: bat, carapace, direnv, eza, fzf, lf, nitch, television, zellij, zellij-ps, zoxide - Centralize in home/base/cli-tools/ with default.nix aggregator - Simplify home/base/packages by removing extracted tools
This commit is contained in:
144
home/base/cli-tools/bat.nix
Normal file
144
home/base/cli-tools/bat.nix
Normal file
@@ -0,0 +1,144 @@
|
|||||||
|
# Bat — cat replacement with nix-colors syntax highlighting theme.
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib; let
|
||||||
|
cfg = config.base.cliTools.bat;
|
||||||
|
palette = config.colorScheme.palette;
|
||||||
|
in {
|
||||||
|
options.base.cliTools.bat.enable = mkEnableOption "enable bat with nix-colors theme";
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
programs.bat = {
|
||||||
|
enable = true;
|
||||||
|
config = {theme = "universal";};
|
||||||
|
themes = {
|
||||||
|
universal = {
|
||||||
|
src = pkgs.writeText "universal.tmTheme" ''
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Universal (nix-colors)</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<array>
|
||||||
|
<dict>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>background</key>
|
||||||
|
<string>#${palette.base00}</string>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#${palette.base05}</string>
|
||||||
|
<key>caret</key>
|
||||||
|
<string>#${palette.base05}</string>
|
||||||
|
<key>selection</key>
|
||||||
|
<string>#${palette.base02}</string>
|
||||||
|
<key>selectionForeground</key>
|
||||||
|
<string>#${palette.base05}</string>
|
||||||
|
<key>lineHighlight</key>
|
||||||
|
<string>#${palette.base01}</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Comment</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>comment</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#${palette.base03}</string>
|
||||||
|
<key>fontStyle</key>
|
||||||
|
<string>italic</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>String</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>string</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#${palette.base0A}</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Number</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>constant.numeric</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#${palette.base0E}</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Keyword</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>keyword</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#${palette.base08}</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Function</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>entity.name.function</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#${palette.base0B}</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Type</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>entity.name.type, storage.type</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#${palette.base0D}</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Variable</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>variable</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#${palette.base05}</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Constant</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>constant</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#${palette.base0E}</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
</array>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
20
home/base/cli-tools/carapace.nix
Normal file
20
home/base/cli-tools/carapace.nix
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
# Carapace — multi-shell completion engine with Fish, Nushell, and Bash integration.
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib; let
|
||||||
|
cfg = config.base.cliTools.carapace;
|
||||||
|
in {
|
||||||
|
options.base.cliTools.carapace.enable = mkEnableOption "enable carapace completion engine";
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
programs.carapace = {
|
||||||
|
enable = true;
|
||||||
|
enableFishIntegration = true;
|
||||||
|
enableNushellIntegration = true;
|
||||||
|
enableBashIntegration = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
17
home/base/cli-tools/default.nix
Normal file
17
home/base/cli-tools/default.nix
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
# CLI tools aggregator — imports all base command-line utilities.
|
||||||
|
{...}: {
|
||||||
|
imports = [
|
||||||
|
./bat.nix
|
||||||
|
./carapace.nix
|
||||||
|
./direnv.nix
|
||||||
|
./eza.nix
|
||||||
|
./fzf.nix
|
||||||
|
./lf.nix
|
||||||
|
./nitch.nix
|
||||||
|
./packages.nix
|
||||||
|
./television.nix
|
||||||
|
./zellij.nix
|
||||||
|
./zellij-ps.nix
|
||||||
|
./zoxide.nix
|
||||||
|
];
|
||||||
|
}
|
||||||
19
home/base/cli-tools/direnv.nix
Normal file
19
home/base/cli-tools/direnv.nix
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
# Direnv — automatic environment loading with nix-direnv integration.
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib; let
|
||||||
|
cfg = config.base.cliTools.direnv;
|
||||||
|
in {
|
||||||
|
options.base.cliTools.direnv.enable = mkEnableOption "enable direnv with nix-direnv";
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
programs.direnv = {
|
||||||
|
enable = true;
|
||||||
|
enableNushellIntegration = true;
|
||||||
|
nix-direnv.enable = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
20
home/base/cli-tools/eza.nix
Normal file
20
home/base/cli-tools/eza.nix
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
# Eza — modern ls replacement with icons, git status, and long format by default.
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib; let
|
||||||
|
cfg = config.base.cliTools.eza;
|
||||||
|
in {
|
||||||
|
options.base.cliTools.eza.enable = mkEnableOption "enable eza modern ls replacement";
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
programs.eza = {
|
||||||
|
enable = true;
|
||||||
|
enableFishIntegration = true;
|
||||||
|
enableBashIntegration = true;
|
||||||
|
extraOptions = ["-l" "--icons" "--git" "-a"];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
40
home/base/cli-tools/fzf.nix
Normal file
40
home/base/cli-tools/fzf.nix
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
# Fuzzy finder with nix-colors palette and Wayland clipboard integration.
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib; let
|
||||||
|
cfg = config.base.cliTools.fzf;
|
||||||
|
in {
|
||||||
|
options.base.cliTools.fzf.enable = mkEnableOption "enable fuzzy finder";
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
programs.fzf = {
|
||||||
|
enable = true;
|
||||||
|
enableFishIntegration = true;
|
||||||
|
colors = {
|
||||||
|
"fg" = "#${config.colorScheme.palette.base05}";
|
||||||
|
"bg" = "#${config.colorScheme.palette.base00}";
|
||||||
|
"hl" = "#${config.colorScheme.palette.base0E}";
|
||||||
|
"fg+" = "#${config.colorScheme.palette.base05}";
|
||||||
|
"bg+" = "#${config.colorScheme.palette.base02}";
|
||||||
|
"hl+" = "#${config.colorScheme.palette.base0E}";
|
||||||
|
"info" = "#${config.colorScheme.palette.base09}";
|
||||||
|
"prompt" = "#${config.colorScheme.palette.base0B}";
|
||||||
|
"pointer" = "#${config.colorScheme.palette.base08}";
|
||||||
|
"marker" = "#${config.colorScheme.palette.base08}";
|
||||||
|
"spinner" = "#${config.colorScheme.palette.base09}";
|
||||||
|
"header" = "#${config.colorScheme.palette.base03}";
|
||||||
|
};
|
||||||
|
defaultOptions = [
|
||||||
|
"--preview='bat --color=always -n {}'"
|
||||||
|
"--bind 'ctrl-/:toggle-preview'"
|
||||||
|
"--header 'Press CTRL-Y to copy command into clipboard'"
|
||||||
|
"--bind 'ctrl-y:execute-silent(echo -n {2..} | wl-copy)+abort'"
|
||||||
|
];
|
||||||
|
defaultCommand = "fd --type f --exclude .git --follow --hidden";
|
||||||
|
changeDirWidgetCommand = "fd --type d --exclude .git --follow --hidden";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
27
home/base/cli-tools/lf.nix
Normal file
27
home/base/cli-tools/lf.nix
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
# Lf — terminal file manager with bat preview and Dracula theme.
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib; let
|
||||||
|
cfg = config.base.cliTools.lf;
|
||||||
|
in {
|
||||||
|
options.base.cliTools.lf.enable = mkEnableOption "enable lf terminal file manager";
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
home.packages = [pkgs.lf];
|
||||||
|
|
||||||
|
programs.lf = {
|
||||||
|
enable = true;
|
||||||
|
settings = {
|
||||||
|
preview = true;
|
||||||
|
drawbox = true;
|
||||||
|
hidden = true;
|
||||||
|
icons = true;
|
||||||
|
previewer = "bat";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
16
home/base/cli-tools/nitch.nix
Normal file
16
home/base/cli-tools/nitch.nix
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
# Nitch — minimal system information display tool.
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib; let
|
||||||
|
cfg = config.base.cliTools.nitch;
|
||||||
|
in {
|
||||||
|
options.base.cliTools.nitch.enable = mkEnableOption "enable nitch";
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
home.packages = [pkgs.nitch];
|
||||||
|
};
|
||||||
|
}
|
||||||
51
home/base/cli-tools/packages.nix
Normal file
51
home/base/cli-tools/packages.nix
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
# Essential CLI packages — core utilities always available on every host.
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib; let
|
||||||
|
cfg = config.base.cliTools.essentials;
|
||||||
|
in {
|
||||||
|
options.base.cliTools.essentials.enable = mkEnableOption "enable essential CLI packages";
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
home.packages = with pkgs; [
|
||||||
|
# Core utilities
|
||||||
|
coreutils
|
||||||
|
fd
|
||||||
|
htop
|
||||||
|
jq
|
||||||
|
ripgrep
|
||||||
|
|
||||||
|
# Dev tools
|
||||||
|
devenv
|
||||||
|
gcc
|
||||||
|
go
|
||||||
|
httpie
|
||||||
|
just
|
||||||
|
lazygit
|
||||||
|
nix-index
|
||||||
|
nix-update
|
||||||
|
progress
|
||||||
|
sqlite
|
||||||
|
sqlite-vec
|
||||||
|
tldr
|
||||||
|
|
||||||
|
# AI tools
|
||||||
|
comma
|
||||||
|
fabric-ai
|
||||||
|
llm
|
||||||
|
|
||||||
|
# Misc
|
||||||
|
basecamp
|
||||||
|
hyprpaper-random
|
||||||
|
libnotify
|
||||||
|
trash-cli
|
||||||
|
unzip
|
||||||
|
yazi
|
||||||
|
zip
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
59
home/base/cli-tools/television.nix
Normal file
59
home/base/cli-tools/television.nix
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
# Television — fuzzy finder with custom channels for tldr, git-diff, and git-log.
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib; let
|
||||||
|
cfg = config.base.cliTools.television;
|
||||||
|
in {
|
||||||
|
options.base.cliTools.television.enable = mkEnableOption "enable television";
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
programs.television = {
|
||||||
|
enable = true;
|
||||||
|
channels = {
|
||||||
|
tldr = {
|
||||||
|
metadata = {
|
||||||
|
description = "Browse TLDR pages";
|
||||||
|
name = "tldr";
|
||||||
|
requirements = ["tldr"];
|
||||||
|
};
|
||||||
|
preview = {
|
||||||
|
command = "tldr '{}'";
|
||||||
|
};
|
||||||
|
source = {
|
||||||
|
command = "tldr --list";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
git-diff = {
|
||||||
|
metadata = {
|
||||||
|
description = "A channel to select files from git diff commands";
|
||||||
|
name = "git-diff";
|
||||||
|
requirements = ["git"];
|
||||||
|
};
|
||||||
|
preview = {
|
||||||
|
command = "git diff HEAD --color=always -- '{}'";
|
||||||
|
};
|
||||||
|
source = {
|
||||||
|
command = "git diff --name-only HEAD";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
git-log = {
|
||||||
|
metadata = {
|
||||||
|
description = "A channel to select from git log entries";
|
||||||
|
name = "git-log";
|
||||||
|
requirements = ["git"];
|
||||||
|
};
|
||||||
|
preview = {
|
||||||
|
command = "git show -p --stat --pretty=fuller --color=always '{0}'";
|
||||||
|
};
|
||||||
|
source = {
|
||||||
|
command = "git log --oneline --date=short --pretty=\"format:%h %s %an %cd\" \"$@\"";
|
||||||
|
output = "{split: :0}";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
27
home/base/cli-tools/zellij-ps.nix
Normal file
27
home/base/cli-tools/zellij-ps.nix
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
# Zellij-ps — project-aware Zellij session manager from m3ta-nixpkgs.
|
||||||
|
# Delegates to the cli.zellij-ps module provided by inputs.m3ta-nixpkgs.
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib; let
|
||||||
|
cfg = config.base.cliTools.zellijPs;
|
||||||
|
in {
|
||||||
|
options.base.cliTools.zellijPs = {
|
||||||
|
enable = mkEnableOption "enable zellij-ps project session manager";
|
||||||
|
|
||||||
|
projectFolders = mkOption {
|
||||||
|
type = types.listOf types.path;
|
||||||
|
description = "Project root folders scanned by zellij-ps.";
|
||||||
|
default = ["${config.home.homeDirectory}/p"];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
cli.zellij-ps = {
|
||||||
|
enable = true;
|
||||||
|
projectFolders = cfg.projectFolders;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
33
home/base/cli-tools/zellij.nix
Normal file
33
home/base/cli-tools/zellij.nix
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
# Zellij terminal multiplexer with nix-colors theming.
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib; let
|
||||||
|
cfg = config.base.cliTools.zellij;
|
||||||
|
in {
|
||||||
|
options.base.cliTools.zellij.enable = mkEnableOption "enable zellij multiplexer";
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
programs.zellij = {
|
||||||
|
enable = true;
|
||||||
|
settings = {
|
||||||
|
theme = "universal";
|
||||||
|
themes.universal = {
|
||||||
|
bg = "#${config.colorScheme.palette.base00}";
|
||||||
|
fg = "#${config.colorScheme.palette.base05}";
|
||||||
|
black = "#${config.colorScheme.palette.base01}";
|
||||||
|
red = "#${config.colorScheme.palette.base08}";
|
||||||
|
green = "#${config.colorScheme.palette.base0B}";
|
||||||
|
yellow = "#${config.colorScheme.palette.base0A}";
|
||||||
|
blue = "#${config.colorScheme.palette.base0D}";
|
||||||
|
magenta = "#${config.colorScheme.palette.base0E}";
|
||||||
|
cyan = "#${config.colorScheme.palette.base0C}";
|
||||||
|
white = "#${config.colorScheme.palette.base07}";
|
||||||
|
orange = "#${config.colorScheme.palette.base09}";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
19
home/base/cli-tools/zoxide.nix
Normal file
19
home/base/cli-tools/zoxide.nix
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
# Zoxide — smarter cd with Fish and Nushell integration.
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib; let
|
||||||
|
cfg = config.base.cliTools.zoxide;
|
||||||
|
in {
|
||||||
|
options.base.cliTools.zoxide.enable = mkEnableOption "enable zoxide smarter cd";
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
programs.zoxide = {
|
||||||
|
enable = true;
|
||||||
|
enableFishIntegration = true;
|
||||||
|
enableNushellIntegration = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user