From 8f903a742adfb8251c07eaa6f6ae68973227846c Mon Sep 17 00:00:00 2001 From: ooks-io Date: Sun, 14 Jul 2024 14:14:48 +1200 Subject: [PATCH] feat(zsh): add plugins module --- home/modules/console/shell/zsh/default.nix | 7 +++++++ home/modules/console/shell/zsh/plugins.nix | 24 ++++++++++++++++++++++ home/modules/desktop/media/music/tui.nix | 6 +++--- nixos/modules/base/shell/bash/default.nix | 5 ++--- 4 files changed, 36 insertions(+), 6 deletions(-) create mode 100644 home/modules/console/shell/zsh/plugins.nix diff --git a/home/modules/console/shell/zsh/default.nix b/home/modules/console/shell/zsh/default.nix index 7b83be3..7e3f2b5 100644 --- a/home/modules/console/shell/zsh/default.nix +++ b/home/modules/console/shell/zsh/default.nix @@ -7,10 +7,17 @@ let in { + imports = [ + ./plugins.nix + ]; + config = mkIf (cfg.enable || admin.shell == "zsh") { programs.zsh = { enable = true; autocd = true; + enableCompletion = true; + autosuggestion.enable = true; + syntaxHighlighting.enable = true; dotDir = ".config/zsh"; history = { expireDuplicatesFirst = true; diff --git a/home/modules/console/shell/zsh/plugins.nix b/home/modules/console/shell/zsh/plugins.nix new file mode 100644 index 0000000..8ec825d --- /dev/null +++ b/home/modules/console/shell/zsh/plugins.nix @@ -0,0 +1,24 @@ +{ lib, pkgs, config, osConfig, ... }: + +let + inherit (lib) mkIf; + cfg = config.ooknet.shell.zsh; + admin = osConfig.ooknet.host.admin; +in + +{ + config = mkIf (cfg.enable || admin.shell == "zsh") { + programs.zsh.plugins = [ + { + name = "fast-syntax-highlighting"; + file = "fast-syntax-highlighting"; + src = "${pkgs.zsh-fast-syntax-highlighting}/share/zsh/site-functions"; + } + { + name = "zsh-autopair"; + file = "autopair.zsh"; + src = "${pkgs.zsh-autopair}/share/zsh/zsh-autopair"; + } + ]; + }; +} diff --git a/home/modules/desktop/media/music/tui.nix b/home/modules/desktop/media/music/tui.nix index f833262..402d8a3 100644 --- a/home/modules/desktop/media/music/tui.nix +++ b/home/modules/desktop/media/music/tui.nix @@ -2,7 +2,7 @@ let inherit (config.colorscheme) palette; - inherit (lib) mkIf; + inherit (lib) mkIf getExe; cfg = config.ooknet.media.music.tui; zellij = config.ooknet.multiplexer.zellij; @@ -115,14 +115,14 @@ in tab name="spotify" focus=true { pane name="spotify" { borderless true - command "spotify_player" + command "${getExe pkgs.spotify-player}" focus true } pane name="Visualizer" { borderless false split_direction "horizontal" size "20%" - command "cava" + command "${getExe pkgs.cava}" } } } diff --git a/nixos/modules/base/shell/bash/default.nix b/nixos/modules/base/shell/bash/default.nix index eb2f54f..a4e4f92 100644 --- a/nixos/modules/base/shell/bash/default.nix +++ b/nixos/modules/base/shell/bash/default.nix @@ -1,13 +1,12 @@ -{ lib, config, pkgs, ... }: +{ lib, config, ... }: let inherit (lib) mkIf; adminShell = config.ooknet.host.admin.shell; - cfg = config.ooknet.shell.zsh; in { - config = mkIf (adminShell == "bash" || cfg.enable) { + config = mkIf (adminShell == "bash" ) { programs.bash = { enable = true; };