From d345455cc91df176b2b1ec7d50e67967c3f18c0c Mon Sep 17 00:00:00 2001 From: Stefan Weigl-Bosker Date: Wed, 5 Mar 2025 15:05:06 -0500 Subject: more improvements to service management --- modules/zsh/default.nix | 41 +++++++++++++++++++++++++++++++++++++ modules/zsh/themes/stefan.zsh-theme | 9 ++++++++ 2 files changed, 50 insertions(+) create mode 100644 modules/zsh/default.nix create mode 100644 modules/zsh/themes/stefan.zsh-theme (limited to 'modules/zsh') diff --git a/modules/zsh/default.nix b/modules/zsh/default.nix new file mode 100644 index 0000000..b1ed82e --- /dev/null +++ b/modules/zsh/default.nix @@ -0,0 +1,41 @@ +{ config, lib, pkgs, ... }: +let + cfg = config.modules.zsh; + + inherit (lib) mkEnableOption mkOption mkIf types; +in +{ + options.modules.zsh = { + enable = mkEnableOption "zsh"; + theme = mkOption { + type = types.str; + description = "name of zsh theme to apply"; + default = "stefan"; + }; + }; + + config = mkIf cfg.enable { + home.packages = with pkgs; [ + zsh + oh-my-zsh + zsh-autosuggestions + ]; + + home.file.".oh-my-zsh/themes" = { + source = ./themes; + recursive = true; + }; + + programs.zsh = { + enable = true; + enableCompletion = true; + autosuggestion.enable = true; + oh-my-zsh = { + enable = true; + }; + initExtra = '' + source ~/.oh-my-zsh/themes/${cfg.theme}.zsh-theme + ''; + }; + }; +} diff --git a/modules/zsh/themes/stefan.zsh-theme b/modules/zsh/themes/stefan.zsh-theme new file mode 100644 index 0000000..4d71d9c --- /dev/null +++ b/modules/zsh/themes/stefan.zsh-theme @@ -0,0 +1,9 @@ +function virtualenv_info { + [ $VIRTUAL_ENV ] && echo '('`basename $VIRTUAL_ENV`') ' +} + +NEWLINE=$'\n' +PROMPT="%F{magenta}%~% %f% %F{yellow}% ${NEWLINE}λ %b%f%" +RPROMPT='$(virtualenv_info)% $(git_prompt_info)' +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" -- cgit v1.2.3