From 16f489be0d8f829b5899627a7291101b03180663 Mon Sep 17 00:00:00 2001 From: tdpeuter Date: Fri, 24 Mar 2023 11:15:51 +0100 Subject: [PATCH] Added zsh --- nixos/flake.lock | 6 +-- nixos/flake.nix | 8 +--- nixos/hosts/Tibo-NixFat/default.nix | 1 + nixos/users/tdpeuter/home.nix | 30 ++++++++++++- stow/zsh/.oh-my-zsh/themes/mrfortem.zsh-theme | 45 +++++++++++++++++++ 5 files changed, 79 insertions(+), 11 deletions(-) create mode 100644 stow/zsh/.oh-my-zsh/themes/mrfortem.zsh-theme diff --git a/nixos/flake.lock b/nixos/flake.lock index 0ddb140..4b1655c 100644 --- a/nixos/flake.lock +++ b/nixos/flake.lock @@ -64,11 +64,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1679318992, - "narHash": "sha256-uoj5Oy6hruIHuxzfQZtcalObe5kPrX9v+ClUMFEOzmE=", + "lastModified": 1679472241, + "narHash": "sha256-VK2YDic2NjPvfsuneJCLIrWS38qUfoW8rLLimx0rWXA=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "e2c97799da5f5cd87adfa5017fba971771e123ef", + "rev": "9ef6e7727f4c31507627815d4f8679c5841efb00", "type": "github" }, "original": { diff --git a/nixos/flake.nix b/nixos/flake.nix index ead0854..67a1c38 100644 --- a/nixos/flake.nix +++ b/nixos/flake.nix @@ -42,12 +42,6 @@ }; modules = [ ./users/tdpeuter/home.nix - { - home = { - username = "tdpeuter"; - homeDirectory = "/home/tdpeuter"; - }; - } ]; }; }; @@ -60,6 +54,6 @@ inherit system; modules = [ ./hosts/Tibo-NixTest ]; }; - }; + }; }; } diff --git a/nixos/hosts/Tibo-NixFat/default.nix b/nixos/hosts/Tibo-NixFat/default.nix index b8b1cbf..5041d2a 100644 --- a/nixos/hosts/Tibo-NixFat/default.nix +++ b/nixos/hosts/Tibo-NixFat/default.nix @@ -112,6 +112,7 @@ packages = with pkgs; [ home-manager ]; + shell = pkgs.zsh; }; # Allow unfree packages diff --git a/nixos/users/tdpeuter/home.nix b/nixos/users/tdpeuter/home.nix index 6158973..32ed637 100644 --- a/nixos/users/tdpeuter/home.nix +++ b/nixos/users/tdpeuter/home.nix @@ -1,6 +1,9 @@ { inputs, lib, config, pkgs, ... }: { + # Check documentation at + # https://rycee.gitlab.io/home-manager/options.html + imports = [ ]; @@ -10,7 +13,7 @@ # paths it should manage. username = "tdpeuter"; homeDirectory = "/home/tdpeuter"; - + # This value determines the Home Manager release that your # configuration is compatible with. This helps avoid breakage # when a new Home Manager release introduces backwards @@ -46,6 +49,9 @@ # Software Engineering Lab 1 android-studio + + # Fonts + font-awesome_5 # Vifm and zsh dependency ]; file = { @@ -54,6 +60,7 @@ ".vim".source = ../../../stow/vim/.vim; ".vimrc".source = ../../../stow/vim/.vimrc; ".config/zellij".source = ../../../stow/zellij/.config/zellij; + ".oh-my-zsh".source = ../../../stow/zsh/.oh-my-zsh; }; }; @@ -72,6 +79,27 @@ }; gpg.enable = true; + + zsh = { + enable = true; + oh-my-zsh = { + enable = true; + custom = "$HOME/.oh-my-zsh"; + plugins = [ "dirhistory" "git" "screen" ]; + theme = "mrfortem"; + }; + plugins = [ + { + name = "cmdtime"; + src = pkgs.fetchFromGitHub { + owner = "tom-auger"; + repo = "cmdtime"; + rev = "ffc72641dcfa0ee6666ceb1dc712b61be30a1e8b"; + hash = "sha256-v6wCfNoPXDD3sS6yUYE6lre8Ir1yJcLGoAW3O8sUOCg="; + }; + } + ]; + }; }; diff --git a/stow/zsh/.oh-my-zsh/themes/mrfortem.zsh-theme b/stow/zsh/.oh-my-zsh/themes/mrfortem.zsh-theme new file mode 100644 index 0000000..53ba179 --- /dev/null +++ b/stow/zsh/.oh-my-zsh/themes/mrfortem.zsh-theme @@ -0,0 +1,45 @@ +# +# ~/.oh-my-zsh/themes/mrfortem.zsh-theme +# Stolen from gentoo-theme and gianni +# + +autoload -Uz colors && colors +autoload -Uz vcs_info + +zstyle ':vcs_info:*' check-for-changes true +zstyle ':vcs_info:*' unstagedstr '%F{red}*' # display this when there are unstaged changes +zstyle ':vcs_info:*' stagedstr '%F{yellow}+' # display this when there are staged changes +zstyle ':vcs_info:*' actionformats '%F{5}(%F{2}%b%F{3}|%F{1}%a%c%u%m%F{5})%f ' +zstyle ':vcs_info:*' formats "%F{white}(%F{cyan} %b%c%u%m%F{white})%f " +zstyle ':vcs_info:svn:*' branchformat '%b' +zstyle ':vcs_info:svn:*' actionformats '%F{5}(%F{2}%b%F{1}:%{3}%i%F{3}|%F{1}%a%c%u%m%F{5})%f ' +zstyle ':vcs_info:svn:*' formats '%F{5}(%F{2}%b%F{1}:%F{3}%i%c%u%m%F{5})%f ' +zstyle ':vcs_info:*' enable git cvs svn +zstyle ':vcs_info:git*+set-message:*' hooks untracked-git + ++vi-untracked-git() { + if command git status --porcelain 2>/dev/null | command grep -q '??'; then + hook_com[misc]='%F{red}?' + else + hook_com[misc]='' + fi +} + +loadgit() { + vcs_info +} + +autoload -U add-zsh-hook +add-zsh-hook precmd loadgit + +# Backup line(s) +# PROMPT='%(!.%B%F{red}.%B%F{green}%n@)%m %F{blue}%(!.%1~.%~) ${vcs_info_msg_0_}%F{blue}%(!.#.$)%k%b%f ' +# PROMPT='%(!.%B%F{red}.%B%F{green}%n@)%m %{$reset_color%}%F{cyan}%c %B${vcs_info_msg_0_}%F{green}%(!.#.$)%k%b%f ' +PROMPT='%(!.%B%F{red}%m .)%{$reset_color%}%F{cyan}%c %B${vcs_info_msg_0_}%F{green}%(!.#.$)%k%b%f ' + +# PROMPT='%{$fg_bold[green]%}[%n@%m%{$reset_color%} %{$fg[cyan]%}%c%{$reset_color%}$(git_prompt_info)%{$fg_bold[green]%}]%{$reset_color%}$ ' + +# ZSH_THEME_GIT_PROMPT_PREFIX=" (%{$fg_bold[cyan]%}" +# ZSH_THEME_GIT_PROMPT_SUFFIX=")" +# ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[green]%} %{$fg[yellow]%}X%{$reset_color%}" +# ZSH_THEME_GIT_PROMPT_CLEAN="%{$reset_color%}"