diff options
| author | Collin Williams <96917990+bluedragon1221@users.noreply.github.com> | 2025-07-08 17:03:20 +0000 |
|---|---|---|
| committer | Collin Williams <96917990+bluedragon1221@users.noreply.github.com> | 2025-07-08 17:14:14 +0000 |
| commit | 82ec91b4d2c253c6ccb783f960a2788f230d6ad1 (patch) | |
| tree | 94dad925340787e5a045d9bb0d094f71dedce036 /modules/terminal/system | |
| parent | cfe198ee85f3c5ee41f4221f49b73dd492b42fdc (diff) | |
start avoiding lib.enum; start using hjem generators
Diffstat (limited to 'modules/terminal/system')
| -rw-r--r-- | modules/terminal/system/default.nix | 1 | ||||
| -rw-r--r-- | modules/terminal/system/programs/broot.nix | 8 | ||||
| -rw-r--r-- | modules/terminal/system/programs/cmus.nix | 43 | ||||
| -rw-r--r-- | modules/terminal/system/programs/git.nix | 29 | ||||
| -rw-r--r-- | modules/terminal/system/programs/helix.nix | 149 | ||||
| -rw-r--r-- | modules/terminal/system/programs/lazygit.nix | 8 | ||||
| -rw-r--r-- | modules/terminal/system/programs/nh.nix | 14 | ||||
| -rw-r--r-- | modules/terminal/system/programs/starship.nix | 9 | ||||
| -rw-r--r-- | modules/terminal/system/programs/tmux.nix | 6 |
9 files changed, 139 insertions, 128 deletions
diff --git a/modules/terminal/system/default.nix b/modules/terminal/system/default.nix index d113944..120e967 100644 --- a/modules/terminal/system/default.nix +++ b/modules/terminal/system/default.nix @@ -4,7 +4,6 @@ in { imports = [ ./programs/fzf.nix ./programs/bat.nix - ./programs/nh.nix ./programs/lazygit.nix ./programs/eza.nix ./programs/starship.nix diff --git a/modules/terminal/system/programs/broot.nix b/modules/terminal/system/programs/broot.nix index 585e07a..ec20605 100644 --- a/modules/terminal/system/programs/broot.nix +++ b/modules/terminal/system/programs/broot.nix @@ -5,9 +5,8 @@ ... }: let cfg = config.collinux.terminal.shells.fish; - toml' = pkgs.formats.toml {}; - conf = toml'.generate "conf.toml" { + conf = { verbs = [ { name = "open-code"; @@ -22,7 +21,10 @@ in lib.mkIf cfg.enable { hjem.users."${config.collinux.user.name}" = { files = { - ".config/broot/conf.toml".source = conf; + ".config/broot/conf.toml" = { + generator = (pkgs.formats.toml {}).generate "conf.toml"; + value = conf; + }; ".config/fish/conf.d/broot.fish".text = lib.mkIf config.collinux.terminal.shells.fish.enable '' ${pkgs.broot}/bin/broot --print-shell-function fish | source diff --git a/modules/terminal/system/programs/cmus.nix b/modules/terminal/system/programs/cmus.nix index 102fa7a..5f7014b 100644 --- a/modules/terminal/system/programs/cmus.nix +++ b/modules/terminal/system/programs/cmus.nix @@ -6,7 +6,9 @@ }: let cfg = config.collinux.terminal.programs.cmus; - scripts.statusDisplay = pkgs.writeShellScriptBin "status.sh" '' + scriptsDir = "~/.config/cmus/scripts"; + + scripts.statusDisplay = '' while [ $# -ge 2 ]; do eval _$1='$2' shift @@ -53,28 +55,37 @@ ''; cmus_rc = '' - colorscheme catppuccin - set status_display_program=${scripts.statusDisplay}/bin/status.sh + ${ + if (cfg.theme == "catppuccin") + then "colorscheme catppuccin" + else "" + } + set status_display_program=${scriptsDir}/status.sh ''; - cava_config = '' - [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' - ''; + 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 = { + ".config/cmus/scripts/status.sh".text = scripts.statusDisplay; + ".config/cmus/rc".text = cmus_rc; - ".config/cmus/catppuccin.theme".text = cmus_theme; + ".config/cmus/catppuccin.theme".text = lib.mkIf (cfg.theme == "catppuccin") cmus_theme; ".config/cava/config".text = cava_config; }; diff --git a/modules/terminal/system/programs/git.nix b/modules/terminal/system/programs/git.nix index 06801af..9943e40 100644 --- a/modules/terminal/system/programs/git.nix +++ b/modules/terminal/system/programs/git.nix @@ -1,26 +1,29 @@ { 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}" - ''; + 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".text = git_config; + ".config/git/config" = { + generator = lib.generators.toGitINI; + value = git_config; + }; }; packages = [pkgs.git]; diff --git a/modules/terminal/system/programs/helix.nix b/modules/terminal/system/programs/helix.nix index 7bd9af1..358aed3 100644 --- a/modules/terminal/system/programs/helix.nix +++ b/modules/terminal/system/programs/helix.nix @@ -5,9 +5,8 @@ ... }: let cfg = config.collinux.terminal.programs.helix; - toml' = pkgs.formats.toml {}; - languages = toml'.generate "languages.toml" { + languages = { language-server = { rust-analyzer.command = "${pkgs.rust-analyzer}/bin/rust-analyzer"; nil.command = "${pkgs.nil}/bin/nil"; @@ -39,7 +38,7 @@ ]; }; - customCatppuccinTheme = toml'.generate "catppuccin_mocha_transparent.toml" { + theme = { inherits = "catppuccin_mocha"; "ui.background" = {}; }; @@ -47,82 +46,81 @@ mkHelixConfig = { theme, hardMode ? false, - }: - toml'.generate "config.toml" { - inherit theme; - editor = { - gutters = ["diff" "diagnostics" "line-numbers" "spacer" "spacer"]; - cursorline = true; - color-modes = true; + }: { + inherit theme; + editor = { + gutters = ["diff" "diagnostics" "line-numbers" "spacer" "spacer"]; + cursorline = true; + color-modes = true; - mouse = !hardMode; + mouse = !hardMode; - lsp.display-inlay-hints = true; + lsp.display-inlay-hints = true; - statusline = { - left = ["mode" "file-name" "spacer" "file-modification-indicator"]; - right = ["spinner" "spacer" "workspace-diagnostics" "file-type"]; - separator = "x"; - }; + 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"; - }; + 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"]; + }; + 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"; + # 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"; } - // ( - if hardMode - then { - "up" = "no_op"; - "down" = "no_op"; - "left" = "no_op"; - "right" = "no_op"; - } - else {} - ); + else {} + ); - insert = - { - "pageup" = "no_op"; - "pagedown" = "no_op"; - "home" = "no_op"; - "end" = "no_op"; + 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"; } - // ( - if hardMode - then { - "up" = "no_op"; - "down" = "no_op"; - "left" = "no_op"; - "right" = "no_op"; - } - else {} - ); + else {} + ); - select = { - "esc" = ["collapse_selection" "insert_mode"]; - }; + select = { + "esc" = ["collapse_selection" "insert_mode"]; }; }; + }; settings = mkHelixConfig { inherit (cfg) hardMode; @@ -136,18 +134,21 @@ in lib.mkIf cfg.enable { hjem.users."${config.collinux.user.name}" = { - files = { - ".config/helix/config.toml".source = settings; - ".config/helix/languages.toml".source = languages; - ".config/helix/themes/catppuccin_mocha_transparent.toml".source = customCatppuccinTheme; + 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; ".config/fish/conf.d/helix.fish".text = lib.mkIf config.collinux.terminal.shells.fish.enable '' set -gx EDITOR hx ''; }; - packages = [ - pkgs.helix - ]; + packages = [pkgs.helix]; }; } diff --git a/modules/terminal/system/programs/lazygit.nix b/modules/terminal/system/programs/lazygit.nix index 4c048a0..280ec07 100644 --- a/modules/terminal/system/programs/lazygit.nix +++ b/modules/terminal/system/programs/lazygit.nix @@ -5,9 +5,8 @@ ... }: let cfg = config.collinux.terminal.programs.lazygit; - yaml' = pkgs.formats.yaml {}; - settings = yaml'.generate "config.yml" { + settings = { git.paging.pager = "${pkgs.diff-so-fancy}/bin/diff-so-fancy"; gui = { showRandomTip = false; @@ -18,7 +17,10 @@ in lib.mkIf cfg.enable { hjem.users."${config.collinux.user.name}" = { files = { - ".config/lazygit/config.yml".source = settings; + ".config/lazygit/config.yml" = { + generator = lib.generators.toYAML {}; + value = settings; + }; }; packages = [pkgs.lazygit]; diff --git a/modules/terminal/system/programs/nh.nix b/modules/terminal/system/programs/nh.nix deleted file mode 100644 index 2fcd674..0000000 --- a/modules/terminal/system/programs/nh.nix +++ /dev/null @@ -1,14 +0,0 @@ -{ - config, - lib, - ... -}: let - cfg = config.collinux.terminal.programs.nh; -in - lib.mkIf cfg.enable { - programs.nh = { - enable = true; - flake = "/home/collin/nixos"; - clean.enable = true; - }; - } diff --git a/modules/terminal/system/programs/starship.nix b/modules/terminal/system/programs/starship.nix index 748c94e..c70a132 100644 --- a/modules/terminal/system/programs/starship.nix +++ b/modules/terminal/system/programs/starship.nix @@ -5,9 +5,8 @@ ... }: let cfg = config.collinux.terminal.programs.starship; - toml' = pkgs.formats.toml {}; - settings = toml'.generate "starship.toml" { + settings = { format = ''$directory$git_branch$git_status $character''; add_newline = false; @@ -38,7 +37,11 @@ in lib.mkIf cfg.enable { hjem.users."${config.collinux.user.name}" = { files = { - ".config/starship.toml".source = settings; + ".config/starship.toml" = { + generator = (pkgs.formats.toml {}).generate "starship.toml"; + value = settings; + }; + ".config/fish/conf.d/starship.fish".text = lib.mkIf config.collinux.terminal.shells.fish.enable '' function starship_transient_prompt_func starship module character diff --git a/modules/terminal/system/programs/tmux.nix b/modules/terminal/system/programs/tmux.nix index 63b9296..18e1593 100644 --- a/modules/terminal/system/programs/tmux.nix +++ b/modules/terminal/system/programs/tmux.nix @@ -132,7 +132,11 @@ set-hook -g window-linked 'if -F "#{==:#{session_windows},1}" { set status off } { set status on }' set-hook -g window-unlinked 'if -F "#{==:#{session_windows},1}" { set status off } { set status on }' - run-shell "${scriptsDir}/bar.sh" + ${ + if (cfg.theme == "catppuccin") + then "run-shell '${scriptsDir}/bar.sh'" + else "" + } # Sessions set-hook -ag client-detached 'run-shell ${scriptsDir}/clean-sessions.sh' |
