From f180fc20f133f148f5be8ff895d45d631677463d Mon Sep 17 00:00:00 2001 From: Gabe Venberg Date: Tue, 7 May 2024 22:20:11 -0500 Subject: [PATCH] changed home-manager/default to common, added non-starship zsh prompt. --- hosts/archlaptop-vm/default.nix | 2 +- hosts/gabe-archlaptop.nix | 3 +- hosts/gabe-gv-workstation.nix | 2 +- hosts/workstation-vm/default.nix | 4 +- .../home-manager/{default.nix => common.nix} | 0 modules/home-manager/terminal/default.nix | 6 +- modules/home-manager/terminal/direnv.nix | 11 ++++ modules/home-manager/terminal/zsh.nix | 56 ++++++++++++++----- modules/hostopts.nix | 4 ++ modules/{both => nixos}/networking.nix | 0 10 files changed, 64 insertions(+), 24 deletions(-) rename modules/home-manager/{default.nix => common.nix} (100%) create mode 100644 modules/home-manager/terminal/direnv.nix rename modules/{both => nixos}/networking.nix (100%) diff --git a/hosts/archlaptop-vm/default.nix b/hosts/archlaptop-vm/default.nix index 01e875a..2d275ed 100644 --- a/hosts/archlaptop-vm/default.nix +++ b/hosts/archlaptop-vm/default.nix @@ -89,7 +89,7 @@ inputs.nixpkgs.lib.nixosSystem { imports = [ ../../modules/home-manager/terminal ../../modules/home-manager/nvim - ../../modules/home-manager + ../../modules/home-manager/common.nix ../../modules/home-manager/email.nix inputs.nixvim.homeManagerModules.nixvim ]; diff --git a/hosts/gabe-archlaptop.nix b/hosts/gabe-archlaptop.nix index aa2694c..18312b7 100644 --- a/hosts/gabe-archlaptop.nix +++ b/hosts/gabe-archlaptop.nix @@ -28,6 +28,7 @@ inputs.home-manager.lib.homeManagerConfiguration { workProfile.enable = false; }; }; + host.isLaptop = true; targets.genericLinux.enable = true; home.username = "gabe"; @@ -35,7 +36,7 @@ inputs.home-manager.lib.homeManagerConfiguration { imports = [ ../modules/home-manager/terminal ../modules/home-manager/nvim - ../modules/home-manager + ../modules/home-manager/common.nix ../modules/home-manager/syncthing.nix ../modules/home-manager/beets.nix ../modules/home-manager/mpd/mpd.nix diff --git a/hosts/gabe-gv-workstation.nix b/hosts/gabe-gv-workstation.nix index a0f008a..b5a7a27 100644 --- a/hosts/gabe-gv-workstation.nix +++ b/hosts/gabe-gv-workstation.nix @@ -39,7 +39,7 @@ inputs.home-manager.lib.homeManagerConfiguration { imports = [ ../modules/home-manager/terminal ../modules/home-manager/nvim - ../modules/home-manager + ../modules/home-manager/common.nix ../modules/home-manager/syncthing.nix ../modules/home-manager/email.nix ../modules/home-manager/beets.nix diff --git a/hosts/workstation-vm/default.nix b/hosts/workstation-vm/default.nix index 3c068a3..8ec75f3 100644 --- a/hosts/workstation-vm/default.nix +++ b/hosts/workstation-vm/default.nix @@ -17,7 +17,7 @@ inputs.nixpkgs.lib.nixosSystem { ../../modules/nixos/common.nix ../../modules/nixos/printing.nix ../../modules/both/sound.nix - ../../modules/both/networking.nix + ../../modules/nixos/networking.nix ../../modules/both/i3 ({ config, @@ -90,7 +90,7 @@ inputs.nixpkgs.lib.nixosSystem { imports = [ ../../modules/home-manager/terminal ../../modules/home-manager/nvim - ../../modules/home-manager + ../../modules/home-manager/common.nix inputs.nixvim.homeManagerModules.nixvim ]; }; diff --git a/modules/home-manager/default.nix b/modules/home-manager/common.nix similarity index 100% rename from modules/home-manager/default.nix rename to modules/home-manager/common.nix diff --git a/modules/home-manager/terminal/default.nix b/modules/home-manager/terminal/default.nix index 5dcbc71..41d974f 100644 --- a/modules/home-manager/terminal/default.nix +++ b/modules/home-manager/terminal/default.nix @@ -9,7 +9,6 @@ just fd sd - scc tre-command diskonaut hyperfine @@ -47,6 +46,7 @@ ./zellij ./tiny-irc.nix ./ssh-agent.nix + ./direnv ]; programs = { @@ -58,9 +58,5 @@ tealdeer.enable = true; btop.enable = true; man.enable = true; - direnv = { - enable = true; - nix-direnv.enable = true; - }; }; } diff --git a/modules/home-manager/terminal/direnv.nix b/modules/home-manager/terminal/direnv.nix new file mode 100644 index 0000000..82d080e --- /dev/null +++ b/modules/home-manager/terminal/direnv.nix @@ -0,0 +1,11 @@ +{ + config, + pgks, + lib, + ... +}: { + programs.direnv = { + enable = true; + nix-direnv.enable = true; + }; +} diff --git a/modules/home-manager/terminal/zsh.nix b/modules/home-manager/terminal/zsh.nix index 5dac191..41bcdc6 100644 --- a/modules/home-manager/terminal/zsh.nix +++ b/modules/home-manager/terminal/zsh.nix @@ -1,6 +1,7 @@ { config, pkgs, + lib, ... }: { programs.starship.enableZshIntegration = true; @@ -14,21 +15,48 @@ programs.zsh = { enable = true; enableCompletion = true; - initExtra = '' - #have the menu highlight while we cycle through options - zstyle ':completion:*' menu select - #case insensitive completion - zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}' - #allow completion from midword - setopt COMPLETE_IN_WORD - #move cursor to end of word after completing - setopt ALWAYS_TO_END - #complete aliases as well - setopt COMPLETE_ALIASES - #select first item when you press tab the first time. - setopt MENU_COMPLETE + initExtra = lib.mkMerge [ + '' + #have the menu highlight while we cycle through options + zstyle ':completion:*' menu select + #case insensitive completion + zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}' + #allow completion from midword + setopt COMPLETE_IN_WORD + #move cursor to end of word after completing + setopt ALWAYS_TO_END + #complete aliases as well + setopt COMPLETE_ALIASES + #select first item when you press tab the first time. + setopt MENU_COMPLETE + '' + (lib.mkif (!config.programs.starship.enable) '' + autoload -U promptinit + promptinit + autoload -U colors + colors - ''; + #stuff to show git things. + autoload -Uz vcs_info + setopt prompt_subst + precmd_vcs() {vcs_info} + #when not in a repo, show full path to current directory. when in one, show path from base direcory of the repo. + zstyle ':vcs_info:*' nvcsformats '%~' + zstyle ':vcs_info:*' formats '%r/%S %F{green}[%b]%f' + zstyle ':vcs_info:*' actionformats '%r/%S %F{green}[%b] %F{red}<%a>%f' + + #the precmd function, called just before printing the prompt. + function precmd() { + precmd_vcs + } + + #Make the right prompt blank, just to be sure. + RPROMPT="" + + #on the top line, show a whole bunch of info. botton line should be as minimal as possilbe (just a single char to input next to...) + PROMPT=$'%F{cyan}[%n@%m]%f%F{red}├────┤%f$${vcs_info_msg_0_} %F{white}[%D %T]%f\n»' + '') + ]; autocd = true; history = { ignoreAllDups = true; diff --git a/modules/hostopts.nix b/modules/hostopts.nix index e090d10..d6519dc 100644 --- a/modules/hostopts.nix +++ b/modules/hostopts.nix @@ -26,6 +26,10 @@ description = "machine is a virtual machine"; default = false; }; + isSever = lib.mkEnableOption { + description = "machine is primarily a server"; + default = false; + }; }; }; } diff --git a/modules/both/networking.nix b/modules/nixos/networking.nix similarity index 100% rename from modules/both/networking.nix rename to modules/nixos/networking.nix