From 7e7c8947fc2ff5598124c4a4c18bd28432fa017e Mon Sep 17 00:00:00 2001 From: Collin Williams <96917990+bluedragon1221@users.noreply.github.com> Date: Mon, 8 Sep 2025 14:01:35 -0500 Subject: rework most of config; probably broke jupiter again; working to add ganymede (non-nixos) to this repo --- modules/terminal/nixos/default.nix | 10 + modules/terminal/nixos/programs/bash.nix | 32 +++ modules/terminal/nixos/programs/bat.nix | 27 +++ modules/terminal/nixos/programs/broot.nix | 138 +++++++++++ modules/terminal/nixos/programs/cmus.nix | 97 ++++++++ modules/terminal/nixos/programs/eza.nix | 27 +++ modules/terminal/nixos/programs/fish.nix | 37 +++ modules/terminal/nixos/programs/fzf.nix | 27 +++ modules/terminal/nixos/programs/git.nix | 31 +++ modules/terminal/nixos/programs/helix.nix | 178 ++++++++++++++ modules/terminal/nixos/programs/lazygit.nix | 41 ++++ modules/terminal/nixos/programs/starship.nix | 64 ++++++ modules/terminal/nixos/programs/tmux.nix | 332 +++++++++++++++++++++++++++ 13 files changed, 1041 insertions(+) create mode 100644 modules/terminal/nixos/default.nix create mode 100644 modules/terminal/nixos/programs/bash.nix create mode 100644 modules/terminal/nixos/programs/bat.nix create mode 100644 modules/terminal/nixos/programs/broot.nix create mode 100644 modules/terminal/nixos/programs/cmus.nix create mode 100644 modules/terminal/nixos/programs/eza.nix create mode 100644 modules/terminal/nixos/programs/fish.nix create mode 100644 modules/terminal/nixos/programs/fzf.nix create mode 100644 modules/terminal/nixos/programs/git.nix create mode 100644 modules/terminal/nixos/programs/helix.nix create mode 100644 modules/terminal/nixos/programs/lazygit.nix create mode 100644 modules/terminal/nixos/programs/starship.nix create mode 100644 modules/terminal/nixos/programs/tmux.nix (limited to 'modules/terminal/nixos') diff --git a/modules/terminal/nixos/default.nix b/modules/terminal/nixos/default.nix new file mode 100644 index 0000000..8118c63 --- /dev/null +++ b/modules/terminal/nixos/default.nix @@ -0,0 +1,10 @@ +{config, ...}: let + cfg = config.collinux.terminal.shells; +in { + programs.command-not-found.enable = false; # broken without nix-channels + + users.users."${config.collinux.user.name}" = { + shell = cfg.defaultShell; + ignoreShellProgramCheck = true; + }; +} diff --git a/modules/terminal/nixos/programs/bash.nix b/modules/terminal/nixos/programs/bash.nix new file mode 100644 index 0000000..ed2c226 --- /dev/null +++ b/modules/terminal/nixos/programs/bash.nix @@ -0,0 +1,32 @@ +{ + pkgs, + config, + lib, + ... +}: let + cfg = config.collinux.terminal.shells.bash; +in + lib.mkIf cfg.enable { + hjem.users."${config.collinux.user.name}" = { + files = { + ".bashrc".text = '' + eval "$(direnv hook bash)" + + for file in ~/.config/bash/conf.d/*; do source "$file"; done + ''; + + packages = with pkgs; [ + fish + ripgrep + fd + moreutils + zip + unzip + btop + jq + direnv + pay-respects + ]; + }; + }; + } diff --git a/modules/terminal/nixos/programs/bat.nix b/modules/terminal/nixos/programs/bat.nix new file mode 100644 index 0000000..d954291 --- /dev/null +++ b/modules/terminal/nixos/programs/bat.nix @@ -0,0 +1,27 @@ +{ + pkgs, + config, + lib, + ... +}: let + cfg = config.collinux.terminal.programs.bat; +in + lib.mkIf cfg.enable { + hjem.users."${config.collinux.user.name}" = { + files = + (lib.optionalAttrs config.collinux.terminal.shells.fish.enable { + ".config/fish/conf.d/bat.fish".text = '' + alias cat bat + set -gx BAT_THEME "base16" + ''; + }) + // (lib.optionalAttrs config.collinux.terminal.shells.bash.enable { + ".config/fish/conf.d/bat.bash".text = '' + alias cat="bat" + export BAT_THEME="base16" + ''; + }); + + packages = [pkgs.bat]; + }; + } diff --git a/modules/terminal/nixos/programs/broot.nix b/modules/terminal/nixos/programs/broot.nix new file mode 100644 index 0000000..6164044 --- /dev/null +++ b/modules/terminal/nixos/programs/broot.nix @@ -0,0 +1,138 @@ +{ + pkgs, + config, + lib, + ... +}: let + cfg = config.collinux.terminal.shells.fish; + + conf = { + skin = catppuccin_skin; + verbs = [ + { + name = "open-code"; + key = "enter"; + execution = "$EDITOR +{line} {file}"; + working_dir = "{root}"; + apply_to = "file"; + leave_broot = true; + } + ]; + }; + + catppuccin_skin = { + input = "rgb(205, 214, 244) none"; + selected_line = "none rgb(88, 91, 112)"; + default = "rgb(205, 214, 244) none"; + tree = "rgb(108, 112, 134) none"; + parent = "rgb(116, 199, 236) none"; + file = "none none"; + + perm__ = "rgb(186, 194, 222) none"; + perm_r = "rgb(250, 179, 135) none"; + perm_w = "rgb(235, 160, 172) none"; + perm_x = "rgb(166, 227, 161) none"; + owner = "rgb(148, 226, 213) none"; + group = "rgb(137, 220, 235) none"; + + dates = "rgb(186, 194, 222) none"; + + directory = "rgb(180, 190, 254) none Bold"; + exe = "rgb(166, 227, 161) none"; + link = "rgb(249, 226, 175) none"; + pruning = "rgb(166, 173, 200) none Italic"; + + preview_title = "rgb(205, 214, 244) rgb(24, 24, 37)"; + preview = "rgb(205, 214, 244) rgb(24, 24, 37)"; + preview_line_number = "rgb(108, 112, 134) none"; + preview_separator = "rgb(108, 112, 134) none"; + + char_match = "rgb(249, 226, 175) rgb(69, 71, 90) Bold Italic"; + content_match = "rgb(249, 226, 175) rgb(69, 71, 90) Bold Italic"; + preview_match = "rgb(249, 226, 175) rgb(69, 71, 90) Bold Italic"; + + count = "rgb(249, 226, 175) none"; + sparse = "rgb(243, 139, 168) none"; + content_extract = "rgb(243, 139, 168) none Italic"; + + git_branch = "rgb(250, 179, 135) none"; + git_insertions = "rgb(250, 179, 135) none"; + git_deletions = "rgb(250, 179, 135) none"; + git_status_current = "rgb(250, 179, 135) none"; + git_status_modified = "rgb(250, 179, 135) none"; + git_status_new = "rgb(250, 179, 135) none Bold"; + git_status_ignored = "rgb(250, 179, 135) none"; + git_status_conflicted = "rgb(250, 179, 135) none"; + git_status_other = "rgb(250, 179, 135) none"; + staging_area_title = "rgb(250, 179, 135) none"; + + flag_label = "rgb(243, 139, 168) none"; + flag_value = "rgb(243, 139, 168) none Bold"; + + status_normal = "none rgb(24, 24, 37)"; + status_italic = "rgb(243, 139, 168) rgb(24, 24, 37) Italic"; + status_bold = "rgb(235, 160, 172) rgb(24, 24, 37) Bold"; + status_ellipsis = "rgb(235, 160, 172) rgb(24, 24, 37) Bold"; + status_error = "rgb(205, 214, 244) rgb(243, 139, 168)"; + status_job = "rgb(235, 160, 172) rgb(40, 38, 37)"; + status_code = "rgb(235, 160, 172) rgb(24, 24, 37) Italic"; + mode_command_mark = "rgb(235, 160, 172) rgb(24, 24, 37) Bold"; + + help_paragraph = "rgb(205, 214, 244) none"; + help_headers = "rgb(243, 139, 168) none Bold"; + help_bold = "rgb(250, 179, 135) none Bold"; + help_italic = "rgb(249, 226, 175) none Italic"; + help_code = "rgb(166, 227, 161) rgb(49, 50, 68)"; + help_table_border = "rgb(108, 112, 134) none"; + + hex_null = "rgb(205, 214, 244) none"; + hex_ascii_graphic = "rgb(250, 179, 135) none"; + hex_ascii_whitespace = "rgb(166, 227, 161) none"; + hex_ascii_other = "rgb(148, 226, 213) none"; + hex_non_ascii = "rgb(243, 139, 168) none"; + + file_error = "rgb(251, 73, 52) none"; + + purpose_normal = "none none"; + purpose_italic = "rgb(177, 98, 134) none Italic"; + purpose_bold = "rgb(177, 98, 134) none Bold"; + purpose_ellipsis = "none none"; + + scrollbar_track = "rgb(49, 50, 68) none"; + scrollbar_thumb = "rgb(88, 91, 112) none"; + + good_to_bad_0 = "rgb(166, 227, 161) none"; + good_to_bad_1 = "rgb(148, 226, 213) none"; + good_to_bad_2 = "rgb(137, 220, 235) none"; + good_to_bad_3 = "rgb(116, 199, 236) none"; + good_to_bad_4 = "rgb(137, 180, 250) none"; + good_to_bad_5 = "rgb(180, 190, 254) none"; + good_to_bad_6 = "rgb(203, 166, 247) none"; + good_to_bad_7 = "rgb(250, 179, 135) none"; + good_to_bad_8 = "rgb(235, 160, 172) none"; + good_to_bad_9 = "rgb(243, 139, 168) none"; + }; +in + lib.mkIf cfg.enable { + hjem.users."${config.collinux.user.name}" = { + files = + { + ".config/broot/conf.toml" = { + generator = (pkgs.formats.toml {}).generate "conf.toml"; + value = conf; + }; + } + // (lib.optionalAttrs config.collinux.terminal.shells.fish.enable { + ".config/fish/conf.d/broot.fish".text = '' + broot --print-shell-function fish | source + ''; + }) + // (lib.optionalAttrs config.collinux.terminal.shells.bash.enable { + ".config/bash/conf.d/broot.bash".text = '' + eval "$(broot --print-shell-function bash)" + ''; + }); + + packages = [pkgs.broot]; + }; + } diff --git a/modules/terminal/nixos/programs/cmus.nix b/modules/terminal/nixos/programs/cmus.nix new file mode 100644 index 0000000..e5184ce --- /dev/null +++ b/modules/terminal/nixos/programs/cmus.nix @@ -0,0 +1,97 @@ +{ + pkgs, + lib, + config, + ... +}: let + cfg = config.collinux.terminal.programs.cmus; + + scriptsDir = "~/.config/cmus/scripts"; + + scripts.statusDisplay = '' + while [ $# -ge 2 ]; do + eval _$1='$2' + shift + shift + done + + [ -d ~/.local/share/cmus ] || mkdir ~/.local/share/cmus + + if [ -n "$_file" ]; then + ${pkgs.ffmpeg}/bin/ffmpeg -i "$_file" -y -an -c:v copy ~/.local/share/cmus/curr_cover.jpg || rm ~/.local/share/cmus/curr_cover.jpg + fi + + ${pkgs.dunst}/bin/dunstify -t 2000 -u low -h string:x-canonical-private-synchronous:music -i ~/.local/share/cmus/curr_cover.jpg "$_status: $_title" "$_artist" + ''; + + cmus_theme = '' + set color_cmdline_bg=default + set color_cmdline_fg=default + set color_error=211 + set color_info=223 + set color_separator=8 + set color_statusline_bg=default + set color_statusline_fg=default + set color_titleline_bg=183 + set color_titleline_fg=8 + set color_titleline_attr=bold + set color_win_bg=default + set color_win_cur=117 + set color_win_cur_sel_bg=117 + set color_win_cur_sel_fg=235 + set color_win_dir=default + set color_win_fg=default + set color_win_inactive_cur_sel_bg=0 + set color_win_inactive_cur_sel_fg=default + set color_win_inactive_sel_bg=0 + set color_win_inactive_sel_fg=default + set color_win_sel_bg=15 + set color_win_sel_fg=235 + set color_win_title_bg=default + set color_win_title_fg=183 + set color_win_title_attr=bold + ''; + + cmus_rc = '' + ${ + if (cfg.theme == "catppuccin") + then "colorscheme catppuccin" + else "" + } + set status_display_program=${scriptsDir}/status.sh + ''; + + cava_config = + if cfg.theme == "catppuccin" + then '' + [color] + gradient=1 + gradient_color_1='#94e2d5' + gradient_color_2='#89dceb' + gradient_color_3='#74c7ec' + gradient_color_4='#89b4fa' + gradient_color_5='#cba6f7' + gradient_color_6='#f5c2e7' + gradient_color_7='#eba0ac' + gradient_color_8='#f38ba8' + '' + else ""; +in + lib.mkIf cfg.enable { + hjem.users."${config.collinux.user.name}" = { + files = let + e = text: { + inherit text; + executable = true; + }; + in { + ".config/cmus/scripts/status.sh" = e scripts.statusDisplay; + + ".config/cmus/rc".text = cmus_rc; + ".config/cmus/catppuccin.theme".text = lib.mkIf (cfg.theme == "catppuccin") cmus_theme; + ".config/cava/config".text = cava_config; + }; + + packages = with pkgs; [cava cmus]; + }; + } diff --git a/modules/terminal/nixos/programs/eza.nix b/modules/terminal/nixos/programs/eza.nix new file mode 100644 index 0000000..acdcbc2 --- /dev/null +++ b/modules/terminal/nixos/programs/eza.nix @@ -0,0 +1,27 @@ +{ + pkgs, + lib, + config, + ... +}: let + cfg = config.collinux.terminal.programs.eza; +in + lib.mkIf cfg.enable { + hjem.users."${config.collinux.user.name}" = { + files = + (lib.optionalAttrs config.collinux.terminal.shells.fish.enable { + ".config/fish/conf.d/eza.fish".text = '' + alias ls "eza -A -w 80 --group-directories-first -I '.git*'" + alias tree "eza -T" + ''; + }) + // (lib.optionalAttrs config.collinux.terminal.shells.fish.enable { + ".config/bash/conf.d/eza.bash".text = '' + alias ls="eza -A -w 80 --group-directories-first -I '.git*'" + alias tree="eza -T" + ''; + }); + + packages = [pkgs.eza]; + }; + } diff --git a/modules/terminal/nixos/programs/fish.nix b/modules/terminal/nixos/programs/fish.nix new file mode 100644 index 0000000..a210cd5 --- /dev/null +++ b/modules/terminal/nixos/programs/fish.nix @@ -0,0 +1,37 @@ +{ + pkgs, + config, + lib, + ... +}: let + cfg = config.collinux.terminal.shells.fish; +in + lib.mkIf cfg.enable { + hjem.users."${config.collinux.user.name}" = { + files = { + ".config/fish/config.fish".text = '' + set fish_greeting + + function fish_title + echo fish (prompt_pwd) + end + + direnv hook fish | source + pay-respects fish --alias | source + ''; + }; + + packages = with pkgs; [ + fish + ripgrep + fd + moreutils + zip + unzip + btop + jq + direnv + pay-respects + ]; + }; + } diff --git a/modules/terminal/nixos/programs/fzf.nix b/modules/terminal/nixos/programs/fzf.nix new file mode 100644 index 0000000..fd86566 --- /dev/null +++ b/modules/terminal/nixos/programs/fzf.nix @@ -0,0 +1,27 @@ +{ + pkgs, + config, + lib, + ... +}: let + cfg = config.collinux.terminal.programs.fzf; +in + lib.mkIf cfg.enable { + hjem.users."${config.collinux.user.name}" = { + files = + (lib.optionalAttrs config.collinux.terminal.shells.fish.enable { + ".config/fish/conf.d/fzf.fish".text = '' + fzf --fish | source + set -gx FZF_DEFAULT_OPTS "--color bg:#1E1E2E,bg+:#313244,border:#313244,fg:#CDD6F4,fg+:#CDD6F4,header:#F38BA8,hl:#F38BA8,hl+:#F38BA8,info:#CBA6F7,label:#CDD6F4,marker:#B4BEFE,pointer:#F5E0DC,prompt:#CBA6F7,selected-bg:#45475A,spinner:#F5E0DC" + ''; + }) + // (lib.optionalAttrs config.collinux.terminal.shells.bash.enable { + ".config/bash/conf.d/fzf.bash".text = '' + eval "$(fzf --bash)" + export FZF_DEFAULT_OPTS="--color bg:#1E1E2E,bg+:#313244,border:#313244,fg:#CDD6F4,fg+:#CDD6F4,header:#F38BA8,hl:#F38BA8,hl+:#F38BA8,info:#CBA6F7,label:#CDD6F4,marker:#B4BEFE,pointer:#F5E0DC,prompt:#CBA6F7,selected-bg:#45475A,spinner:#F5E0DC" + ''; + }); + + packages = [pkgs.fzf]; + }; + } diff --git a/modules/terminal/nixos/programs/git.nix b/modules/terminal/nixos/programs/git.nix new file mode 100644 index 0000000..9943e40 --- /dev/null +++ b/modules/terminal/nixos/programs/git.nix @@ -0,0 +1,31 @@ +{ + config, + lib, + pkgs, + ... +}: let + cfg = config.collinux.terminal.programs.git; + + git_config = { + alias = { + stage = "add"; + unstage = "restore --staged"; + }; + init.defaultBranch = "main"; + user = { + email = cfg.userEmail; + name = cfg.userName; + }; + }; +in { + hjem.users."${config.collinux.user.name}" = { + files = { + ".config/git/config" = { + generator = lib.generators.toGitINI; + value = git_config; + }; + }; + + packages = [pkgs.git]; + }; +} diff --git a/modules/terminal/nixos/programs/helix.nix b/modules/terminal/nixos/programs/helix.nix new file mode 100644 index 0000000..54a6932 --- /dev/null +++ b/modules/terminal/nixos/programs/helix.nix @@ -0,0 +1,178 @@ +{ + pkgs, + lib, + config, + ... +}: let + cfg = config.collinux.terminal.programs.helix; + + languages = { + language-server = { + rust-analyzer.command = "${pkgs.rust-analyzer}/bin/rust-analyzer"; + + nil = { + command = "${pkgs.nil}/bin/nil"; + config = { + nil.nix.flake.autoArchive = true; + }; + }; + superhtml = { + command = "${pkgs.superhtml}/bin/superhtml"; + args = ["lsp"]; + }; + dhall-lsp-server.command = "${pkgs.dhall-lsp-server}/bin/dhall-lsp-server"; + }; + + language = [ + { + name = "nix"; + file-types = ["nix"]; + language-servers = ["nil"]; + indent = { + tab-width = 2; + unit = " "; + }; + formatter.command = "${pkgs.alejandra}/bin/alejandra"; + auto-format = true; + } + { + name = "html"; + file-types = ["html"]; + language-servers = ["superhtml"]; + auto-format = true; + } + ]; + }; + + theme = { + inherits = "catppuccin_mocha"; + "ui.background" = {}; + }; + + mkHelixConfig = { + theme, + hardMode ? false, + }: { + inherit theme; + editor = { + gutters = ["diff" "diagnostics" "line-numbers" "spacer" "spacer"]; + cursorline = true; + color-modes = true; + + mouse = !hardMode; + + lsp.display-inlay-hints = true; + + statusline = { + left = ["mode" "file-name" "spacer" "file-modification-indicator"]; + right = ["spinner" "spacer" "workspace-diagnostics" "file-type"]; + separator = "x"; + }; + + cursor-shape = { + insert = "bar"; + normal = "block"; + select = "underline"; + }; + }; + keys = { + normal = + { + "C-space" = "expand_selection"; + "A-j" = ["extend_to_line_bounds" "delete_selection" "paste_after"]; + "A-k" = ["extend_to_line_bounds" "delete_selection" "move_line_up" "paste_before"]; + "X" = ["extend_line_up" "extend_to_line_bounds"]; + "C-left" = "goto_line_start"; + "C-right" = "goto_line_end"; + ";" = "flip_selections"; + "esc" = ["collapse_selection" "keep_primary_selection"]; + + # I don't even use these anyway + "pageup" = "no_op"; + "pagedown" = "no_op"; + "home" = "no_op"; + "end" = "no_op"; + } + // ( + if hardMode + then { + "up" = "no_op"; + "down" = "no_op"; + "left" = "no_op"; + "right" = "no_op"; + } + else {} + ); + + insert = + { + "pageup" = "no_op"; + "pagedown" = "no_op"; + "home" = "no_op"; + "end" = "no_op"; + } + // ( + if hardMode + then { + "up" = "no_op"; + "down" = "no_op"; + "left" = "no_op"; + "right" = "no_op"; + } + else {} + ); + + select = { + "esc" = ["collapse_selection" "insert_mode"]; + }; + }; + }; + + settings = mkHelixConfig { + inherit (cfg) hardMode; + theme = + if cfg.theme == "catppuccin" + then "catppuccin_mocha_transparent" + else if cfg.theme == "adwaita" + then "adwaita_dark" + else ""; + }; +in + lib.mkIf cfg.enable { + nixpkgs.overlays = [ + (self: super: { + # rename window to filename when editing file + helix = self.writeShellScriptBin "hx" '' + file="$1" + printf '\033]2;%s\033\\' "hx $file" + exec ${super.helix}/bin/hx "$@" + ''; + }) + ]; + + hjem.users."${config.collinux.user.name}" = { + files = let + t = value: { + generator = (pkgs.formats.toml {}).generate "toml_file"; + inherit value; + }; + in + { + ".config/helix/config.toml" = t settings; + ".config/helix/languages.toml" = t languages; + ".config/helix/themes/catppuccin_mocha_transparent.toml" = t theme; + } + // (lib.optionalAttrs config.collinux.terminal.shells.fish.enable { + ".config/fish/conf.d/helix.fish".text = '' + set -gx EDITOR hx + ''; + }) + // (lib.optionalAttrs config.collinux.terminal.shells.bash.enable { + ".config/bash/conf.d/helix.bash".text = '' + EDITOR=hx + ''; + }); + + packages = [pkgs.helix]; + }; + } diff --git a/modules/terminal/nixos/programs/lazygit.nix b/modules/terminal/nixos/programs/lazygit.nix new file mode 100644 index 0000000..e3e2b42 --- /dev/null +++ b/modules/terminal/nixos/programs/lazygit.nix @@ -0,0 +1,41 @@ +{ + pkgs, + config, + lib, + ... +}: let + cfg = config.collinux.terminal.programs.lazygit; + + settings = { + git.paging.pager = "${pkgs.diff-so-fancy}/bin/diff-so-fancy"; + gui = { + showRandomTip = false; + commitLength.show = false; + showListFooter = false; + showCommandLog = false; + showPanelJumps = false; + statusPanelView = "allBranchesLog"; + }; + update.method = "never"; + notARepository = "quit"; + + quitOnTopLevelReturn = true; + disableStartupPopups = true; + promptToReturnFromSubprocess = false; + + theme.inactiveBorderColor = ["#313244"]; + theme.activeBorderColor = ["#89b4fa"]; + }; +in + lib.mkIf cfg.enable { + hjem.users."${config.collinux.user.name}" = { + files = { + ".config/lazygit/config.yml" = { + generator = lib.generators.toYAML {}; + value = settings; + }; + }; + + packages = [pkgs.lazygit]; + }; + } diff --git a/modules/terminal/nixos/programs/starship.nix b/modules/terminal/nixos/programs/starship.nix new file mode 100644 index 0000000..f0134f0 --- /dev/null +++ b/modules/terminal/nixos/programs/starship.nix @@ -0,0 +1,64 @@ +{ + pkgs, + lib, + config, + ... +}: let + cfg = config.collinux.terminal.programs.starship; + + settings = { + format = ''$directory$git_branch$git_status $character''; + + add_newline = false; + scan_timeout = 10; + + character = { + success_symbol = "[λ](green bold)"; + error_symbol = "[Σ](red bold)"; + }; + + git_branch.format = "[@$branch](underline)"; + + git_status = { + format = "$modified$staged$ahead$behind"; + modified = "[!](red bold)"; + staged = "[+](green bold)"; + ahead = "[/](green)"; + behind = "[\](red)"; + }; + + directory = { + format = "$path"; + truncation_length = 3; + truncate_to_repo = true; + }; + }; +in + lib.mkIf cfg.enable { + hjem.users."${config.collinux.user.name}" = { + files = + { + ".config/starship.toml" = { + generator = (pkgs.formats.toml {}).generate "starship.toml"; + value = settings; + }; + } + // (lib.optionalAttrs config.collinux.terminal.shells.fish.enable { + ".config/fish/conf.d/starship.fish".text = '' + function starship_transient_prompt_func + starship module character + end + + starship init fish | source + enable_transience + ''; + }) + // (lib.optionalAttrs config.collinux.terminal.shells.bash.enable { + ".config/bash/conf.d/starship.bash".text = '' + eval "$(starship init bash)" + ''; + }); + + packages = [pkgs.starship]; + }; + } diff --git a/modules/terminal/nixos/programs/tmux.nix b/modules/terminal/nixos/programs/tmux.nix new file mode 100644 index 0000000..c349ded --- /dev/null +++ b/modules/terminal/nixos/programs/tmux.nix @@ -0,0 +1,332 @@ +{ + lib, + config, + pkgs, + ... +}: let + cfg = config.collinux.terminal.programs.tmux; + + scriptsDir = "~/.config/tmux/scripts"; + + scripts.minibuffer = '' + window_height="$(tmux display -p '#{window_height}')" + tmux display-popup -EB \ + -w 100% -h 16 \ + -x 0 -y "$(($window_height + 1))" \ + "$@" + ''; + + scripts.menu = '' + tmux display-menu \ + -x "#{window_width}" -y S \ + -b none \ + -s "bg=#313244,fg=#9399b2" \ + -S "bg=#313244" \ + -H "bg=#45475a fg=#b4befe" \ + "$@" + ''; + + scripts.paneSplit = '' + width=$(tmux display -p "#{pane_width}") + height=$(tmux display -p "#{pane_height}") + + if (( $(echo "$width / $height > 2.5" | bc -l) )); then + tmux split-window -h "$@" + else + tmux split-window -v "$@" + fi + ''; + + # -- SESSIONIZER -- + broot_sessionizer_config = { + imports = ["~/.config/broot/conf.toml"]; + quit_on_last_cancel = true; + verbs = [ + { + invocation = "sessionizer"; + external = ''bash -c -- "${scriptsDir}/sessionizer.sh '{file}'"''; + key = "enter"; + apply_to = "directory"; + leave_broot = true; + } + ]; + }; + + scripts.sessionizer = '' + selected="$1" + + session_name="$(basename "$selected" | tr '.' '_')" + + # if the session doesn't exist, create it + if tmux list-sessions -F '#{session_name}' | grep -vqx "$session_name"; then + tmux new-session -ds "$session_name" -c "$selected" + tmux set-option -t "$session_name" @default-path "$selected" + fi + + # switch to it + tmux switch -t "$session_name" + ''; + + scripts.newSession = '' + tmux switch-client -t "$(tmux new-session -dP)" + ''; + + scripts.sessionsMenu = '' + menu_items=( + "Switch Project" p "run-shell '${scriptsDir}/minibuffer.sh -d $HOME ${scriptsDir}/launch-sessionizer.sh'" + "New Unnamed Project" n "run-shell '${scriptsDir}/new-session.sh'" + ) + + # Get all tmux session names + mapfile -t sessions < <(tmux list-sessions -F "#{session_name}") + + # Only include up to 9 sessions + for i in "''\${!sessions[@]}"; do + (( i >= 9 )) && break # Stop after 9 sessions + + session="''\${sessions[$i]}" + key=$((i + 1)) # 1-based key + + menu_items+=("$session" "$key" "switch-client -t $session") + done + + # Display the menu + ${scriptsDir}/menu.sh -T "#[align=centre]Projects" "''\${menu_items[@]}" + ''; + + scripts.cleanSessions = '' + current="$(tmux display -p '#{session_name}')" + + tmux list-sessions -F '#{session_name}' | while read -r line; do + if [[ "$line" != "$current" && "$line" =~ ^[[:digit:]]+$ ]]; then + tmux kill-session -t "$line" + fi + done + ''; + + scripts.launchSessionizer = ''broot --only-folders --conf ~/.config/tmux/broot/sessionizer.toml''; + + # -- FIND FILE -- + broot_file_config = { + imports = ["~/.config/broot/conf.toml"]; + quit_on_last_cancel = true; + verbs = [ + { + invocation = "tmux-split"; + external = ["bash" "-c" ''${scriptsDir}/split.sh -c "#{?@default-path,#{@default-path},#{pane_current_path}}" "hx '{file}'"'']; + key = "ctrl-s"; + apply_to = "file"; + leave_broot = true; + } + { + invocation = "tmux-window"; + external = ["tmux" "new-window" "-c" "#{?@default-path,#{@default-path},#{pane_current_path}}" "hx '{file}'"]; + key = "ctrl-w"; + apply_to = "file"; + leave_broot = true; + } + { + key = "enter"; + cmd = ":tmux-window"; + } + ]; + }; + + scripts.launchFindFile = ''broot --conf ~/.config/tmux/broot/file.toml''; + + # -- BAR -- + scripts.battery = '' + energy_now=$(cat /sys/class/power_supply/BAT0/energy_now) + energy_full=$(cat /sys/class/power_supply/BAT0/energy_full) + percentage=$((energy_now * 100 / energy_full)) + printf "%.0f%%" "$percentage" + ''; + + scripts.bar = '' + bg="#1e1e2e" + + tmux set -g status on + + tmux set -g status-position bottom + tmux set -g status-justify absolute-centre + tmux set -g status-bg "$bg" + + tmux set -g status-left-style fg=green,bold + tmux set -g status-left " #{client_session}" + + tmux set -g window-status-style fg=color243 + tmux set -g window-status-format " #I " + tmux set -g window-status-current-style fg=color12,bold + tmux set -g window-status-current-format " #I " + tmux set -g window-status-separator "" + + tmux set -g status-right "#[fg=color243]%l:%M #[fg=red]#(${scriptsDir}/battery.sh) " + + bg_dark="#181825" + + ## pane borders + tmux set -g pane-border-style fg=$bg_dark,bg=$bg_dark + tmux set -g pane-active-border-style fg=$bg_dark,bg=$bg_dark + + ## pane backgrounds + # Set the foreground/background color for the active window + tmux set -g window-active-style bg=$bg + + # Set the foreground/background color for all other windows + tmux set -g window-style bg=$bg_dark + ''; + + # -- FZF EXEC -- + scripts.tmuxDoc = '' + usage=$(tmux list-commands -F "#{command_list_name} #{command_list_usage}" "$1") + + man tmux | awk -v usage="$usage" ' + index($0, usage) > 0 { found=1 } + found { + print + if ($0 == "") exit + } + ' + ''; + + scripts.fzfExec = '' + all_cmds() { + tmux list-commands -F $'#{command_list_name}#{?command_list_alias,\n#{command_list_alias},}' + } + + selected_cmd=$(all_cmds | fzf --bind 'enter:accept-or-print-query,tab:replace-query,alt-backspace:clear-query' --prompt : --preview "~/.config/tmux/scripts/tmux-doc.sh $(printf '{}' | cut -d' ' -f1)") + test -z "$selected_cmd" && exit + + tmux $(echo "$selected_cmd" | sed "s@~@$HOME@g") + ''; + + # -- BUFFER SEARCH -- + scripts.searchBuffer = '' + trap 'rm -f -- "''\${scrollback:-}"' EXIT + scrollback="$(mktemp)" + + tmux capture-pane -e -p -S - > "$scrollback" + cat "$scrollback" | fzf --ansi + + exit 0 + ''; + + # -- PANE SEARCH -- + scripts.paneSearch = '' + LIST_DATA="#{window_name} #{pane_title} #{pane_current_path} #{pane_current_command}" + FZF_COMMAND="fzf --delimiter=: --with-nth 4 --color=hl:2" + + # do not change + TARGET_SPEC="#{session_name}:#{window_id}:#{pane_id}:" + + # select pane + LINE=$(tmux list-panes -a -F "$TARGET_SPEC $LIST_DATA" | $FZF_COMMAND) || exit 0 + # split the result + args=(''\${LINE//:/ }) + # activate session/window/pane + tmux select-pane -t ''\${args[2]} && tmux select-window -t ''\${args[1]} && tmux switch-client -t ''\${args[0]} + ''; + + # -- LEADER MENU -- + scripts.leaderMenu = '' + ${scriptsDir}/menu.sh -T "#[align=centre]Prefix" \ + "+Projects" C-p "run-shell ${scriptsDir}/sessions-menu.sh" \ + "Find File" C-f "run-shell \"${scriptsDir}/minibuffer.sh -d '#{?@default-path,#{@default-path},#{pane_current_path}}' '${scriptsDir}/launch-find-file.sh'\"" \ + "Find Window" C-w "run-shell \"${scriptsDir}/minibuffer.sh '${scriptsDir}/pane-search.sh'\"" \ + "Detach" C-d "detach" \ + "Lazygit" C-g "display-popup -E -w 80% -h 80% -x C -y C -d '#{?@default-path,#{@default-path},#{pane_current_path}}' lazygit" \ + "Search Buffer" / "run-shell \"${scriptsDir}/minibuffer.sh '${scriptsDir}/search-buffer.sh'\"" \ + "Todo" C-o "display-popup -E -w 70% -h 70% -x C -y C 'hx ~/Documents/todo.txt'" \ + "Reload" C-r "source-file ~/.config/tmux/tmux.conf" + ''; + + tmux-conf = '' + set -g mouse on + + # Panes + bind-key -n C-w kill-pane + + bind -n C-Enter run-shell "${scriptsDir}/split.sh -c '#{?@default-path,#{@default-path},#{pane_current_path}}'" + + unbind -n MouseDown3Pane ## disable right click menu + bind-key -n M-z resize-pane -Z ## Pane zoom + set -g allow-rename on + set -g automatic-rename off + + # Windows + bind-key -n C-t new-window -c '#{?@default-path,#{@default-path},#{pane_current_path}}' + bind-key -n C-Tab next-window + bind-key -n C-S-Tab previous-window # doesn't work in foot :( + unbind n + unbind p + + set -g renumber-windows on + set -g base-index 1 + + bind-key -n C-x run-shell "${scriptsDir}/leader-menu.sh" + bind-key -n M-x run-shell "${scriptsDir}/minibuffer.sh -h 10 '${scriptsDir}/fzf-exec.sh'" + + set-hook -ag client-detached 'run-shell ${scriptsDir}/clean-sessions.sh' + set-hook -ag client-session-changed 'run-shell ${scriptsDir}/clean-sessions.sh' + + # Statusbar + run-shell "${scriptsDir}/bar.sh" + + # Scrollback + set-window-option -g mode-keys vi + ''; +in + lib.mkIf cfg.enable { + hjem.users."${config.collinux.user.name}" = { + files = let + e = text: { + inherit text; + executable = true; + }; + in { + # helpers + ".config/tmux/scripts/minibuffer.sh" = e scripts.minibuffer; + ".config/tmux/scripts/menu.sh" = e scripts.menu; + ".config/tmux/scripts/split.sh" = e scripts.paneSplit; + + # sessionizer + ".config/tmux/scripts/sessionizer.sh" = e scripts.sessionizer; + ".config/tmux/broot/sessionizer.toml" = { + generator = (pkgs.formats.toml {}).generate "sessionizer.toml"; + value = broot_sessionizer_config; + }; + ".config/tmux/scripts/launch-sessionizer.sh" = e scripts.launchSessionizer; + ".config/tmux/scripts/clean-sessions.sh" = e scripts.cleanSessions; + ".config/tmux/scripts/new-session.sh" = e scripts.newSession; + ".config/tmux/scripts/sessions-menu.sh" = e scripts.sessionsMenu; + + # find-file + ".config/tmux/scripts/launch-find-file.sh" = e scripts.launchFindFile; + ".config/tmux/broot/file.toml" = { + generator = (pkgs.formats.toml {}).generate "file.toml"; + value = broot_file_config; + }; + + # search buffer + ".config/tmux/scripts/search-buffer.sh" = e scripts.searchBuffer; + + # pane search + ".config/tmux/scripts/pane-search.sh" = e scripts.paneSearch; + + # fzf-exec + ".config/tmux/scripts/tmux-doc.sh" = e scripts.tmuxDoc; + ".config/tmux/scripts/fzf-exec.sh" = e scripts.fzfExec; + + # leader menu + ".config/tmux/scripts/leader-menu.sh" = e scripts.leaderMenu; + + # Bar + ".config/tmux/scripts/battery.sh" = e scripts.battery; + ".config/tmux/scripts/bar.sh" = e scripts.bar; + + ".config/tmux/tmux.conf".text = tmux-conf; + }; + + packages = [pkgs.tmux]; + }; + } -- cgit v1.3.1 From 5d0d346f838a7711fa79eb6edab828107b95a499 Mon Sep 17 00:00:00 2001 From: Collin Williams <96917990+bluedragon1221@users.noreply.github.com> Date: Sun, 14 Sep 2025 13:59:30 -0500 Subject: remove obsolete programs cfg --- modules/terminal/nixos/programs/bash.nix | 32 --- modules/terminal/nixos/programs/bat.nix | 27 --- modules/terminal/nixos/programs/broot.nix | 138 ----------- modules/terminal/nixos/programs/cmus.nix | 97 -------- modules/terminal/nixos/programs/eza.nix | 27 --- modules/terminal/nixos/programs/fish.nix | 37 --- modules/terminal/nixos/programs/fzf.nix | 27 --- modules/terminal/nixos/programs/git.nix | 31 --- modules/terminal/nixos/programs/helix.nix | 178 -------------- modules/terminal/nixos/programs/lazygit.nix | 41 ---- modules/terminal/nixos/programs/starship.nix | 64 ------ modules/terminal/nixos/programs/tmux.nix | 332 --------------------------- 12 files changed, 1031 deletions(-) delete mode 100644 modules/terminal/nixos/programs/bash.nix delete mode 100644 modules/terminal/nixos/programs/bat.nix delete mode 100644 modules/terminal/nixos/programs/broot.nix delete mode 100644 modules/terminal/nixos/programs/cmus.nix delete mode 100644 modules/terminal/nixos/programs/eza.nix delete mode 100644 modules/terminal/nixos/programs/fish.nix delete mode 100644 modules/terminal/nixos/programs/fzf.nix delete mode 100644 modules/terminal/nixos/programs/git.nix delete mode 100644 modules/terminal/nixos/programs/helix.nix delete mode 100644 modules/terminal/nixos/programs/lazygit.nix delete mode 100644 modules/terminal/nixos/programs/starship.nix delete mode 100644 modules/terminal/nixos/programs/tmux.nix (limited to 'modules/terminal/nixos') diff --git a/modules/terminal/nixos/programs/bash.nix b/modules/terminal/nixos/programs/bash.nix deleted file mode 100644 index ed2c226..0000000 --- a/modules/terminal/nixos/programs/bash.nix +++ /dev/null @@ -1,32 +0,0 @@ -{ - pkgs, - config, - lib, - ... -}: let - cfg = config.collinux.terminal.shells.bash; -in - lib.mkIf cfg.enable { - hjem.users."${config.collinux.user.name}" = { - files = { - ".bashrc".text = '' - eval "$(direnv hook bash)" - - for file in ~/.config/bash/conf.d/*; do source "$file"; done - ''; - - packages = with pkgs; [ - fish - ripgrep - fd - moreutils - zip - unzip - btop - jq - direnv - pay-respects - ]; - }; - }; - } diff --git a/modules/terminal/nixos/programs/bat.nix b/modules/terminal/nixos/programs/bat.nix deleted file mode 100644 index d954291..0000000 --- a/modules/terminal/nixos/programs/bat.nix +++ /dev/null @@ -1,27 +0,0 @@ -{ - pkgs, - config, - lib, - ... -}: let - cfg = config.collinux.terminal.programs.bat; -in - lib.mkIf cfg.enable { - hjem.users."${config.collinux.user.name}" = { - files = - (lib.optionalAttrs config.collinux.terminal.shells.fish.enable { - ".config/fish/conf.d/bat.fish".text = '' - alias cat bat - set -gx BAT_THEME "base16" - ''; - }) - // (lib.optionalAttrs config.collinux.terminal.shells.bash.enable { - ".config/fish/conf.d/bat.bash".text = '' - alias cat="bat" - export BAT_THEME="base16" - ''; - }); - - packages = [pkgs.bat]; - }; - } diff --git a/modules/terminal/nixos/programs/broot.nix b/modules/terminal/nixos/programs/broot.nix deleted file mode 100644 index 6164044..0000000 --- a/modules/terminal/nixos/programs/broot.nix +++ /dev/null @@ -1,138 +0,0 @@ -{ - pkgs, - config, - lib, - ... -}: let - cfg = config.collinux.terminal.shells.fish; - - conf = { - skin = catppuccin_skin; - verbs = [ - { - name = "open-code"; - key = "enter"; - execution = "$EDITOR +{line} {file}"; - working_dir = "{root}"; - apply_to = "file"; - leave_broot = true; - } - ]; - }; - - catppuccin_skin = { - input = "rgb(205, 214, 244) none"; - selected_line = "none rgb(88, 91, 112)"; - default = "rgb(205, 214, 244) none"; - tree = "rgb(108, 112, 134) none"; - parent = "rgb(116, 199, 236) none"; - file = "none none"; - - perm__ = "rgb(186, 194, 222) none"; - perm_r = "rgb(250, 179, 135) none"; - perm_w = "rgb(235, 160, 172) none"; - perm_x = "rgb(166, 227, 161) none"; - owner = "rgb(148, 226, 213) none"; - group = "rgb(137, 220, 235) none"; - - dates = "rgb(186, 194, 222) none"; - - directory = "rgb(180, 190, 254) none Bold"; - exe = "rgb(166, 227, 161) none"; - link = "rgb(249, 226, 175) none"; - pruning = "rgb(166, 173, 200) none Italic"; - - preview_title = "rgb(205, 214, 244) rgb(24, 24, 37)"; - preview = "rgb(205, 214, 244) rgb(24, 24, 37)"; - preview_line_number = "rgb(108, 112, 134) none"; - preview_separator = "rgb(108, 112, 134) none"; - - char_match = "rgb(249, 226, 175) rgb(69, 71, 90) Bold Italic"; - content_match = "rgb(249, 226, 175) rgb(69, 71, 90) Bold Italic"; - preview_match = "rgb(249, 226, 175) rgb(69, 71, 90) Bold Italic"; - - count = "rgb(249, 226, 175) none"; - sparse = "rgb(243, 139, 168) none"; - content_extract = "rgb(243, 139, 168) none Italic"; - - git_branch = "rgb(250, 179, 135) none"; - git_insertions = "rgb(250, 179, 135) none"; - git_deletions = "rgb(250, 179, 135) none"; - git_status_current = "rgb(250, 179, 135) none"; - git_status_modified = "rgb(250, 179, 135) none"; - git_status_new = "rgb(250, 179, 135) none Bold"; - git_status_ignored = "rgb(250, 179, 135) none"; - git_status_conflicted = "rgb(250, 179, 135) none"; - git_status_other = "rgb(250, 179, 135) none"; - staging_area_title = "rgb(250, 179, 135) none"; - - flag_label = "rgb(243, 139, 168) none"; - flag_value = "rgb(243, 139, 168) none Bold"; - - status_normal = "none rgb(24, 24, 37)"; - status_italic = "rgb(243, 139, 168) rgb(24, 24, 37) Italic"; - status_bold = "rgb(235, 160, 172) rgb(24, 24, 37) Bold"; - status_ellipsis = "rgb(235, 160, 172) rgb(24, 24, 37) Bold"; - status_error = "rgb(205, 214, 244) rgb(243, 139, 168)"; - status_job = "rgb(235, 160, 172) rgb(40, 38, 37)"; - status_code = "rgb(235, 160, 172) rgb(24, 24, 37) Italic"; - mode_command_mark = "rgb(235, 160, 172) rgb(24, 24, 37) Bold"; - - help_paragraph = "rgb(205, 214, 244) none"; - help_headers = "rgb(243, 139, 168) none Bold"; - help_bold = "rgb(250, 179, 135) none Bold"; - help_italic = "rgb(249, 226, 175) none Italic"; - help_code = "rgb(166, 227, 161) rgb(49, 50, 68)"; - help_table_border = "rgb(108, 112, 134) none"; - - hex_null = "rgb(205, 214, 244) none"; - hex_ascii_graphic = "rgb(250, 179, 135) none"; - hex_ascii_whitespace = "rgb(166, 227, 161) none"; - hex_ascii_other = "rgb(148, 226, 213) none"; - hex_non_ascii = "rgb(243, 139, 168) none"; - - file_error = "rgb(251, 73, 52) none"; - - purpose_normal = "none none"; - purpose_italic = "rgb(177, 98, 134) none Italic"; - purpose_bold = "rgb(177, 98, 134) none Bold"; - purpose_ellipsis = "none none"; - - scrollbar_track = "rgb(49, 50, 68) none"; - scrollbar_thumb = "rgb(88, 91, 112) none"; - - good_to_bad_0 = "rgb(166, 227, 161) none"; - good_to_bad_1 = "rgb(148, 226, 213) none"; - good_to_bad_2 = "rgb(137, 220, 235) none"; - good_to_bad_3 = "rgb(116, 199, 236) none"; - good_to_bad_4 = "rgb(137, 180, 250) none"; - good_to_bad_5 = "rgb(180, 190, 254) none"; - good_to_bad_6 = "rgb(203, 166, 247) none"; - good_to_bad_7 = "rgb(250, 179, 135) none"; - good_to_bad_8 = "rgb(235, 160, 172) none"; - good_to_bad_9 = "rgb(243, 139, 168) none"; - }; -in - lib.mkIf cfg.enable { - hjem.users."${config.collinux.user.name}" = { - files = - { - ".config/broot/conf.toml" = { - generator = (pkgs.formats.toml {}).generate "conf.toml"; - value = conf; - }; - } - // (lib.optionalAttrs config.collinux.terminal.shells.fish.enable { - ".config/fish/conf.d/broot.fish".text = '' - broot --print-shell-function fish | source - ''; - }) - // (lib.optionalAttrs config.collinux.terminal.shells.bash.enable { - ".config/bash/conf.d/broot.bash".text = '' - eval "$(broot --print-shell-function bash)" - ''; - }); - - packages = [pkgs.broot]; - }; - } diff --git a/modules/terminal/nixos/programs/cmus.nix b/modules/terminal/nixos/programs/cmus.nix deleted file mode 100644 index e5184ce..0000000 --- a/modules/terminal/nixos/programs/cmus.nix +++ /dev/null @@ -1,97 +0,0 @@ -{ - pkgs, - lib, - config, - ... -}: let - cfg = config.collinux.terminal.programs.cmus; - - scriptsDir = "~/.config/cmus/scripts"; - - scripts.statusDisplay = '' - while [ $# -ge 2 ]; do - eval _$1='$2' - shift - shift - done - - [ -d ~/.local/share/cmus ] || mkdir ~/.local/share/cmus - - if [ -n "$_file" ]; then - ${pkgs.ffmpeg}/bin/ffmpeg -i "$_file" -y -an -c:v copy ~/.local/share/cmus/curr_cover.jpg || rm ~/.local/share/cmus/curr_cover.jpg - fi - - ${pkgs.dunst}/bin/dunstify -t 2000 -u low -h string:x-canonical-private-synchronous:music -i ~/.local/share/cmus/curr_cover.jpg "$_status: $_title" "$_artist" - ''; - - cmus_theme = '' - set color_cmdline_bg=default - set color_cmdline_fg=default - set color_error=211 - set color_info=223 - set color_separator=8 - set color_statusline_bg=default - set color_statusline_fg=default - set color_titleline_bg=183 - set color_titleline_fg=8 - set color_titleline_attr=bold - set color_win_bg=default - set color_win_cur=117 - set color_win_cur_sel_bg=117 - set color_win_cur_sel_fg=235 - set color_win_dir=default - set color_win_fg=default - set color_win_inactive_cur_sel_bg=0 - set color_win_inactive_cur_sel_fg=default - set color_win_inactive_sel_bg=0 - set color_win_inactive_sel_fg=default - set color_win_sel_bg=15 - set color_win_sel_fg=235 - set color_win_title_bg=default - set color_win_title_fg=183 - set color_win_title_attr=bold - ''; - - cmus_rc = '' - ${ - if (cfg.theme == "catppuccin") - then "colorscheme catppuccin" - else "" - } - set status_display_program=${scriptsDir}/status.sh - ''; - - cava_config = - if cfg.theme == "catppuccin" - then '' - [color] - gradient=1 - gradient_color_1='#94e2d5' - gradient_color_2='#89dceb' - gradient_color_3='#74c7ec' - gradient_color_4='#89b4fa' - gradient_color_5='#cba6f7' - gradient_color_6='#f5c2e7' - gradient_color_7='#eba0ac' - gradient_color_8='#f38ba8' - '' - else ""; -in - lib.mkIf cfg.enable { - hjem.users."${config.collinux.user.name}" = { - files = let - e = text: { - inherit text; - executable = true; - }; - in { - ".config/cmus/scripts/status.sh" = e scripts.statusDisplay; - - ".config/cmus/rc".text = cmus_rc; - ".config/cmus/catppuccin.theme".text = lib.mkIf (cfg.theme == "catppuccin") cmus_theme; - ".config/cava/config".text = cava_config; - }; - - packages = with pkgs; [cava cmus]; - }; - } diff --git a/modules/terminal/nixos/programs/eza.nix b/modules/terminal/nixos/programs/eza.nix deleted file mode 100644 index acdcbc2..0000000 --- a/modules/terminal/nixos/programs/eza.nix +++ /dev/null @@ -1,27 +0,0 @@ -{ - pkgs, - lib, - config, - ... -}: let - cfg = config.collinux.terminal.programs.eza; -in - lib.mkIf cfg.enable { - hjem.users."${config.collinux.user.name}" = { - files = - (lib.optionalAttrs config.collinux.terminal.shells.fish.enable { - ".config/fish/conf.d/eza.fish".text = '' - alias ls "eza -A -w 80 --group-directories-first -I '.git*'" - alias tree "eza -T" - ''; - }) - // (lib.optionalAttrs config.collinux.terminal.shells.fish.enable { - ".config/bash/conf.d/eza.bash".text = '' - alias ls="eza -A -w 80 --group-directories-first -I '.git*'" - alias tree="eza -T" - ''; - }); - - packages = [pkgs.eza]; - }; - } diff --git a/modules/terminal/nixos/programs/fish.nix b/modules/terminal/nixos/programs/fish.nix deleted file mode 100644 index a210cd5..0000000 --- a/modules/terminal/nixos/programs/fish.nix +++ /dev/null @@ -1,37 +0,0 @@ -{ - pkgs, - config, - lib, - ... -}: let - cfg = config.collinux.terminal.shells.fish; -in - lib.mkIf cfg.enable { - hjem.users."${config.collinux.user.name}" = { - files = { - ".config/fish/config.fish".text = '' - set fish_greeting - - function fish_title - echo fish (prompt_pwd) - end - - direnv hook fish | source - pay-respects fish --alias | source - ''; - }; - - packages = with pkgs; [ - fish - ripgrep - fd - moreutils - zip - unzip - btop - jq - direnv - pay-respects - ]; - }; - } diff --git a/modules/terminal/nixos/programs/fzf.nix b/modules/terminal/nixos/programs/fzf.nix deleted file mode 100644 index fd86566..0000000 --- a/modules/terminal/nixos/programs/fzf.nix +++ /dev/null @@ -1,27 +0,0 @@ -{ - pkgs, - config, - lib, - ... -}: let - cfg = config.collinux.terminal.programs.fzf; -in - lib.mkIf cfg.enable { - hjem.users."${config.collinux.user.name}" = { - files = - (lib.optionalAttrs config.collinux.terminal.shells.fish.enable { - ".config/fish/conf.d/fzf.fish".text = '' - fzf --fish | source - set -gx FZF_DEFAULT_OPTS "--color bg:#1E1E2E,bg+:#313244,border:#313244,fg:#CDD6F4,fg+:#CDD6F4,header:#F38BA8,hl:#F38BA8,hl+:#F38BA8,info:#CBA6F7,label:#CDD6F4,marker:#B4BEFE,pointer:#F5E0DC,prompt:#CBA6F7,selected-bg:#45475A,spinner:#F5E0DC" - ''; - }) - // (lib.optionalAttrs config.collinux.terminal.shells.bash.enable { - ".config/bash/conf.d/fzf.bash".text = '' - eval "$(fzf --bash)" - export FZF_DEFAULT_OPTS="--color bg:#1E1E2E,bg+:#313244,border:#313244,fg:#CDD6F4,fg+:#CDD6F4,header:#F38BA8,hl:#F38BA8,hl+:#F38BA8,info:#CBA6F7,label:#CDD6F4,marker:#B4BEFE,pointer:#F5E0DC,prompt:#CBA6F7,selected-bg:#45475A,spinner:#F5E0DC" - ''; - }); - - packages = [pkgs.fzf]; - }; - } diff --git a/modules/terminal/nixos/programs/git.nix b/modules/terminal/nixos/programs/git.nix deleted file mode 100644 index 9943e40..0000000 --- a/modules/terminal/nixos/programs/git.nix +++ /dev/null @@ -1,31 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: let - cfg = config.collinux.terminal.programs.git; - - git_config = { - alias = { - stage = "add"; - unstage = "restore --staged"; - }; - init.defaultBranch = "main"; - user = { - email = cfg.userEmail; - name = cfg.userName; - }; - }; -in { - hjem.users."${config.collinux.user.name}" = { - files = { - ".config/git/config" = { - generator = lib.generators.toGitINI; - value = git_config; - }; - }; - - packages = [pkgs.git]; - }; -} diff --git a/modules/terminal/nixos/programs/helix.nix b/modules/terminal/nixos/programs/helix.nix deleted file mode 100644 index 54a6932..0000000 --- a/modules/terminal/nixos/programs/helix.nix +++ /dev/null @@ -1,178 +0,0 @@ -{ - pkgs, - lib, - config, - ... -}: let - cfg = config.collinux.terminal.programs.helix; - - languages = { - language-server = { - rust-analyzer.command = "${pkgs.rust-analyzer}/bin/rust-analyzer"; - - nil = { - command = "${pkgs.nil}/bin/nil"; - config = { - nil.nix.flake.autoArchive = true; - }; - }; - superhtml = { - command = "${pkgs.superhtml}/bin/superhtml"; - args = ["lsp"]; - }; - dhall-lsp-server.command = "${pkgs.dhall-lsp-server}/bin/dhall-lsp-server"; - }; - - language = [ - { - name = "nix"; - file-types = ["nix"]; - language-servers = ["nil"]; - indent = { - tab-width = 2; - unit = " "; - }; - formatter.command = "${pkgs.alejandra}/bin/alejandra"; - auto-format = true; - } - { - name = "html"; - file-types = ["html"]; - language-servers = ["superhtml"]; - auto-format = true; - } - ]; - }; - - theme = { - inherits = "catppuccin_mocha"; - "ui.background" = {}; - }; - - mkHelixConfig = { - theme, - hardMode ? false, - }: { - inherit theme; - editor = { - gutters = ["diff" "diagnostics" "line-numbers" "spacer" "spacer"]; - cursorline = true; - color-modes = true; - - mouse = !hardMode; - - lsp.display-inlay-hints = true; - - statusline = { - left = ["mode" "file-name" "spacer" "file-modification-indicator"]; - right = ["spinner" "spacer" "workspace-diagnostics" "file-type"]; - separator = "x"; - }; - - cursor-shape = { - insert = "bar"; - normal = "block"; - select = "underline"; - }; - }; - keys = { - normal = - { - "C-space" = "expand_selection"; - "A-j" = ["extend_to_line_bounds" "delete_selection" "paste_after"]; - "A-k" = ["extend_to_line_bounds" "delete_selection" "move_line_up" "paste_before"]; - "X" = ["extend_line_up" "extend_to_line_bounds"]; - "C-left" = "goto_line_start"; - "C-right" = "goto_line_end"; - ";" = "flip_selections"; - "esc" = ["collapse_selection" "keep_primary_selection"]; - - # I don't even use these anyway - "pageup" = "no_op"; - "pagedown" = "no_op"; - "home" = "no_op"; - "end" = "no_op"; - } - // ( - if hardMode - then { - "up" = "no_op"; - "down" = "no_op"; - "left" = "no_op"; - "right" = "no_op"; - } - else {} - ); - - insert = - { - "pageup" = "no_op"; - "pagedown" = "no_op"; - "home" = "no_op"; - "end" = "no_op"; - } - // ( - if hardMode - then { - "up" = "no_op"; - "down" = "no_op"; - "left" = "no_op"; - "right" = "no_op"; - } - else {} - ); - - select = { - "esc" = ["collapse_selection" "insert_mode"]; - }; - }; - }; - - settings = mkHelixConfig { - inherit (cfg) hardMode; - theme = - if cfg.theme == "catppuccin" - then "catppuccin_mocha_transparent" - else if cfg.theme == "adwaita" - then "adwaita_dark" - else ""; - }; -in - lib.mkIf cfg.enable { - nixpkgs.overlays = [ - (self: super: { - # rename window to filename when editing file - helix = self.writeShellScriptBin "hx" '' - file="$1" - printf '\033]2;%s\033\\' "hx $file" - exec ${super.helix}/bin/hx "$@" - ''; - }) - ]; - - hjem.users."${config.collinux.user.name}" = { - files = let - t = value: { - generator = (pkgs.formats.toml {}).generate "toml_file"; - inherit value; - }; - in - { - ".config/helix/config.toml" = t settings; - ".config/helix/languages.toml" = t languages; - ".config/helix/themes/catppuccin_mocha_transparent.toml" = t theme; - } - // (lib.optionalAttrs config.collinux.terminal.shells.fish.enable { - ".config/fish/conf.d/helix.fish".text = '' - set -gx EDITOR hx - ''; - }) - // (lib.optionalAttrs config.collinux.terminal.shells.bash.enable { - ".config/bash/conf.d/helix.bash".text = '' - EDITOR=hx - ''; - }); - - packages = [pkgs.helix]; - }; - } diff --git a/modules/terminal/nixos/programs/lazygit.nix b/modules/terminal/nixos/programs/lazygit.nix deleted file mode 100644 index e3e2b42..0000000 --- a/modules/terminal/nixos/programs/lazygit.nix +++ /dev/null @@ -1,41 +0,0 @@ -{ - pkgs, - config, - lib, - ... -}: let - cfg = config.collinux.terminal.programs.lazygit; - - settings = { - git.paging.pager = "${pkgs.diff-so-fancy}/bin/diff-so-fancy"; - gui = { - showRandomTip = false; - commitLength.show = false; - showListFooter = false; - showCommandLog = false; - showPanelJumps = false; - statusPanelView = "allBranchesLog"; - }; - update.method = "never"; - notARepository = "quit"; - - quitOnTopLevelReturn = true; - disableStartupPopups = true; - promptToReturnFromSubprocess = false; - - theme.inactiveBorderColor = ["#313244"]; - theme.activeBorderColor = ["#89b4fa"]; - }; -in - lib.mkIf cfg.enable { - hjem.users."${config.collinux.user.name}" = { - files = { - ".config/lazygit/config.yml" = { - generator = lib.generators.toYAML {}; - value = settings; - }; - }; - - packages = [pkgs.lazygit]; - }; - } diff --git a/modules/terminal/nixos/programs/starship.nix b/modules/terminal/nixos/programs/starship.nix deleted file mode 100644 index f0134f0..0000000 --- a/modules/terminal/nixos/programs/starship.nix +++ /dev/null @@ -1,64 +0,0 @@ -{ - pkgs, - lib, - config, - ... -}: let - cfg = config.collinux.terminal.programs.starship; - - settings = { - format = ''$directory$git_branch$git_status $character''; - - add_newline = false; - scan_timeout = 10; - - character = { - success_symbol = "[λ](green bold)"; - error_symbol = "[Σ](red bold)"; - }; - - git_branch.format = "[@$branch](underline)"; - - git_status = { - format = "$modified$staged$ahead$behind"; - modified = "[!](red bold)"; - staged = "[+](green bold)"; - ahead = "[/](green)"; - behind = "[\](red)"; - }; - - directory = { - format = "$path"; - truncation_length = 3; - truncate_to_repo = true; - }; - }; -in - lib.mkIf cfg.enable { - hjem.users."${config.collinux.user.name}" = { - files = - { - ".config/starship.toml" = { - generator = (pkgs.formats.toml {}).generate "starship.toml"; - value = settings; - }; - } - // (lib.optionalAttrs config.collinux.terminal.shells.fish.enable { - ".config/fish/conf.d/starship.fish".text = '' - function starship_transient_prompt_func - starship module character - end - - starship init fish | source - enable_transience - ''; - }) - // (lib.optionalAttrs config.collinux.terminal.shells.bash.enable { - ".config/bash/conf.d/starship.bash".text = '' - eval "$(starship init bash)" - ''; - }); - - packages = [pkgs.starship]; - }; - } diff --git a/modules/terminal/nixos/programs/tmux.nix b/modules/terminal/nixos/programs/tmux.nix deleted file mode 100644 index c349ded..0000000 --- a/modules/terminal/nixos/programs/tmux.nix +++ /dev/null @@ -1,332 +0,0 @@ -{ - lib, - config, - pkgs, - ... -}: let - cfg = config.collinux.terminal.programs.tmux; - - scriptsDir = "~/.config/tmux/scripts"; - - scripts.minibuffer = '' - window_height="$(tmux display -p '#{window_height}')" - tmux display-popup -EB \ - -w 100% -h 16 \ - -x 0 -y "$(($window_height + 1))" \ - "$@" - ''; - - scripts.menu = '' - tmux display-menu \ - -x "#{window_width}" -y S \ - -b none \ - -s "bg=#313244,fg=#9399b2" \ - -S "bg=#313244" \ - -H "bg=#45475a fg=#b4befe" \ - "$@" - ''; - - scripts.paneSplit = '' - width=$(tmux display -p "#{pane_width}") - height=$(tmux display -p "#{pane_height}") - - if (( $(echo "$width / $height > 2.5" | bc -l) )); then - tmux split-window -h "$@" - else - tmux split-window -v "$@" - fi - ''; - - # -- SESSIONIZER -- - broot_sessionizer_config = { - imports = ["~/.config/broot/conf.toml"]; - quit_on_last_cancel = true; - verbs = [ - { - invocation = "sessionizer"; - external = ''bash -c -- "${scriptsDir}/sessionizer.sh '{file}'"''; - key = "enter"; - apply_to = "directory"; - leave_broot = true; - } - ]; - }; - - scripts.sessionizer = '' - selected="$1" - - session_name="$(basename "$selected" | tr '.' '_')" - - # if the session doesn't exist, create it - if tmux list-sessions -F '#{session_name}' | grep -vqx "$session_name"; then - tmux new-session -ds "$session_name" -c "$selected" - tmux set-option -t "$session_name" @default-path "$selected" - fi - - # switch to it - tmux switch -t "$session_name" - ''; - - scripts.newSession = '' - tmux switch-client -t "$(tmux new-session -dP)" - ''; - - scripts.sessionsMenu = '' - menu_items=( - "Switch Project" p "run-shell '${scriptsDir}/minibuffer.sh -d $HOME ${scriptsDir}/launch-sessionizer.sh'" - "New Unnamed Project" n "run-shell '${scriptsDir}/new-session.sh'" - ) - - # Get all tmux session names - mapfile -t sessions < <(tmux list-sessions -F "#{session_name}") - - # Only include up to 9 sessions - for i in "''\${!sessions[@]}"; do - (( i >= 9 )) && break # Stop after 9 sessions - - session="''\${sessions[$i]}" - key=$((i + 1)) # 1-based key - - menu_items+=("$session" "$key" "switch-client -t $session") - done - - # Display the menu - ${scriptsDir}/menu.sh -T "#[align=centre]Projects" "''\${menu_items[@]}" - ''; - - scripts.cleanSessions = '' - current="$(tmux display -p '#{session_name}')" - - tmux list-sessions -F '#{session_name}' | while read -r line; do - if [[ "$line" != "$current" && "$line" =~ ^[[:digit:]]+$ ]]; then - tmux kill-session -t "$line" - fi - done - ''; - - scripts.launchSessionizer = ''broot --only-folders --conf ~/.config/tmux/broot/sessionizer.toml''; - - # -- FIND FILE -- - broot_file_config = { - imports = ["~/.config/broot/conf.toml"]; - quit_on_last_cancel = true; - verbs = [ - { - invocation = "tmux-split"; - external = ["bash" "-c" ''${scriptsDir}/split.sh -c "#{?@default-path,#{@default-path},#{pane_current_path}}" "hx '{file}'"'']; - key = "ctrl-s"; - apply_to = "file"; - leave_broot = true; - } - { - invocation = "tmux-window"; - external = ["tmux" "new-window" "-c" "#{?@default-path,#{@default-path},#{pane_current_path}}" "hx '{file}'"]; - key = "ctrl-w"; - apply_to = "file"; - leave_broot = true; - } - { - key = "enter"; - cmd = ":tmux-window"; - } - ]; - }; - - scripts.launchFindFile = ''broot --conf ~/.config/tmux/broot/file.toml''; - - # -- BAR -- - scripts.battery = '' - energy_now=$(cat /sys/class/power_supply/BAT0/energy_now) - energy_full=$(cat /sys/class/power_supply/BAT0/energy_full) - percentage=$((energy_now * 100 / energy_full)) - printf "%.0f%%" "$percentage" - ''; - - scripts.bar = '' - bg="#1e1e2e" - - tmux set -g status on - - tmux set -g status-position bottom - tmux set -g status-justify absolute-centre - tmux set -g status-bg "$bg" - - tmux set -g status-left-style fg=green,bold - tmux set -g status-left " #{client_session}" - - tmux set -g window-status-style fg=color243 - tmux set -g window-status-format " #I " - tmux set -g window-status-current-style fg=color12,bold - tmux set -g window-status-current-format " #I " - tmux set -g window-status-separator "" - - tmux set -g status-right "#[fg=color243]%l:%M #[fg=red]#(${scriptsDir}/battery.sh) " - - bg_dark="#181825" - - ## pane borders - tmux set -g pane-border-style fg=$bg_dark,bg=$bg_dark - tmux set -g pane-active-border-style fg=$bg_dark,bg=$bg_dark - - ## pane backgrounds - # Set the foreground/background color for the active window - tmux set -g window-active-style bg=$bg - - # Set the foreground/background color for all other windows - tmux set -g window-style bg=$bg_dark - ''; - - # -- FZF EXEC -- - scripts.tmuxDoc = '' - usage=$(tmux list-commands -F "#{command_list_name} #{command_list_usage}" "$1") - - man tmux | awk -v usage="$usage" ' - index($0, usage) > 0 { found=1 } - found { - print - if ($0 == "") exit - } - ' - ''; - - scripts.fzfExec = '' - all_cmds() { - tmux list-commands -F $'#{command_list_name}#{?command_list_alias,\n#{command_list_alias},}' - } - - selected_cmd=$(all_cmds | fzf --bind 'enter:accept-or-print-query,tab:replace-query,alt-backspace:clear-query' --prompt : --preview "~/.config/tmux/scripts/tmux-doc.sh $(printf '{}' | cut -d' ' -f1)") - test -z "$selected_cmd" && exit - - tmux $(echo "$selected_cmd" | sed "s@~@$HOME@g") - ''; - - # -- BUFFER SEARCH -- - scripts.searchBuffer = '' - trap 'rm -f -- "''\${scrollback:-}"' EXIT - scrollback="$(mktemp)" - - tmux capture-pane -e -p -S - > "$scrollback" - cat "$scrollback" | fzf --ansi - - exit 0 - ''; - - # -- PANE SEARCH -- - scripts.paneSearch = '' - LIST_DATA="#{window_name} #{pane_title} #{pane_current_path} #{pane_current_command}" - FZF_COMMAND="fzf --delimiter=: --with-nth 4 --color=hl:2" - - # do not change - TARGET_SPEC="#{session_name}:#{window_id}:#{pane_id}:" - - # select pane - LINE=$(tmux list-panes -a -F "$TARGET_SPEC $LIST_DATA" | $FZF_COMMAND) || exit 0 - # split the result - args=(''\${LINE//:/ }) - # activate session/window/pane - tmux select-pane -t ''\${args[2]} && tmux select-window -t ''\${args[1]} && tmux switch-client -t ''\${args[0]} - ''; - - # -- LEADER MENU -- - scripts.leaderMenu = '' - ${scriptsDir}/menu.sh -T "#[align=centre]Prefix" \ - "+Projects" C-p "run-shell ${scriptsDir}/sessions-menu.sh" \ - "Find File" C-f "run-shell \"${scriptsDir}/minibuffer.sh -d '#{?@default-path,#{@default-path},#{pane_current_path}}' '${scriptsDir}/launch-find-file.sh'\"" \ - "Find Window" C-w "run-shell \"${scriptsDir}/minibuffer.sh '${scriptsDir}/pane-search.sh'\"" \ - "Detach" C-d "detach" \ - "Lazygit" C-g "display-popup -E -w 80% -h 80% -x C -y C -d '#{?@default-path,#{@default-path},#{pane_current_path}}' lazygit" \ - "Search Buffer" / "run-shell \"${scriptsDir}/minibuffer.sh '${scriptsDir}/search-buffer.sh'\"" \ - "Todo" C-o "display-popup -E -w 70% -h 70% -x C -y C 'hx ~/Documents/todo.txt'" \ - "Reload" C-r "source-file ~/.config/tmux/tmux.conf" - ''; - - tmux-conf = '' - set -g mouse on - - # Panes - bind-key -n C-w kill-pane - - bind -n C-Enter run-shell "${scriptsDir}/split.sh -c '#{?@default-path,#{@default-path},#{pane_current_path}}'" - - unbind -n MouseDown3Pane ## disable right click menu - bind-key -n M-z resize-pane -Z ## Pane zoom - set -g allow-rename on - set -g automatic-rename off - - # Windows - bind-key -n C-t new-window -c '#{?@default-path,#{@default-path},#{pane_current_path}}' - bind-key -n C-Tab next-window - bind-key -n C-S-Tab previous-window # doesn't work in foot :( - unbind n - unbind p - - set -g renumber-windows on - set -g base-index 1 - - bind-key -n C-x run-shell "${scriptsDir}/leader-menu.sh" - bind-key -n M-x run-shell "${scriptsDir}/minibuffer.sh -h 10 '${scriptsDir}/fzf-exec.sh'" - - set-hook -ag client-detached 'run-shell ${scriptsDir}/clean-sessions.sh' - set-hook -ag client-session-changed 'run-shell ${scriptsDir}/clean-sessions.sh' - - # Statusbar - run-shell "${scriptsDir}/bar.sh" - - # Scrollback - set-window-option -g mode-keys vi - ''; -in - lib.mkIf cfg.enable { - hjem.users."${config.collinux.user.name}" = { - files = let - e = text: { - inherit text; - executable = true; - }; - in { - # helpers - ".config/tmux/scripts/minibuffer.sh" = e scripts.minibuffer; - ".config/tmux/scripts/menu.sh" = e scripts.menu; - ".config/tmux/scripts/split.sh" = e scripts.paneSplit; - - # sessionizer - ".config/tmux/scripts/sessionizer.sh" = e scripts.sessionizer; - ".config/tmux/broot/sessionizer.toml" = { - generator = (pkgs.formats.toml {}).generate "sessionizer.toml"; - value = broot_sessionizer_config; - }; - ".config/tmux/scripts/launch-sessionizer.sh" = e scripts.launchSessionizer; - ".config/tmux/scripts/clean-sessions.sh" = e scripts.cleanSessions; - ".config/tmux/scripts/new-session.sh" = e scripts.newSession; - ".config/tmux/scripts/sessions-menu.sh" = e scripts.sessionsMenu; - - # find-file - ".config/tmux/scripts/launch-find-file.sh" = e scripts.launchFindFile; - ".config/tmux/broot/file.toml" = { - generator = (pkgs.formats.toml {}).generate "file.toml"; - value = broot_file_config; - }; - - # search buffer - ".config/tmux/scripts/search-buffer.sh" = e scripts.searchBuffer; - - # pane search - ".config/tmux/scripts/pane-search.sh" = e scripts.paneSearch; - - # fzf-exec - ".config/tmux/scripts/tmux-doc.sh" = e scripts.tmuxDoc; - ".config/tmux/scripts/fzf-exec.sh" = e scripts.fzfExec; - - # leader menu - ".config/tmux/scripts/leader-menu.sh" = e scripts.leaderMenu; - - # Bar - ".config/tmux/scripts/battery.sh" = e scripts.battery; - ".config/tmux/scripts/bar.sh" = e scripts.bar; - - ".config/tmux/tmux.conf".text = tmux-conf; - }; - - packages = [pkgs.tmux]; - }; - } -- cgit v1.3.1