diff --git a/flake.nix b/flake.nix index f875e7c..e595878 100644 --- a/flake.nix +++ b/flake.nix @@ -225,7 +225,15 @@ ]; home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; + home-manager.users.root = { + home.stateVersion = "22.11"; + imports = [ + home-manager-utils.hmModule + #stylix.homeManagerModules.stylix + ]; + }; home-manager.users.mainUser = { + home.stateVersion = "22.11"; imports = [ doom-emacs-nix.hmModule home-manager-utils.hmModule diff --git a/nixos/components/gui/home-manager/default.nix b/nixos/components/gui/home-manager/default.nix index 11dac28..83fb2f9 100644 --- a/nixos/components/gui/home-manager/default.nix +++ b/nixos/components/gui/home-manager/default.nix @@ -9,6 +9,8 @@ with lib; ./i3.nix ]; + # todo slice this configuration file properly + # todo a home-manager folder make no sense config = mkIf config.components.gui.enable { # don't run autoload -U compinit && compinit before ~/.zshrc @@ -16,8 +18,6 @@ with lib; home-manager.users.mainUser = { - home.stateVersion = "22.11"; - # a better cat programs.bat = { enable = true; diff --git a/nixos/components/terminal/default.nix b/nixos/components/terminal/default.nix index cb9fd43..ee2fcf1 100644 --- a/nixos/components/terminal/default.nix +++ b/nixos/components/terminal/default.nix @@ -2,15 +2,20 @@ with lib; { options.components.terminal = { - enable = lib.mkEnableOption "Terminal configurations"; + enable = mkOption { + type = types.bool; + default = true; + }; }; imports = [ ./direnv.nix + ./git.nix ./hoard.nix + ./oh-my-posh.nix ./remote-install.nix ./wtf.nix - ./git.nix + ./zsh.nix ]; config = mkIf config.components.terminal.enable { diff --git a/nixos/components/terminal/oh-my-posh.nix b/nixos/components/terminal/oh-my-posh.nix new file mode 100644 index 0000000..fb4820d --- /dev/null +++ b/nixos/components/terminal/oh-my-posh.nix @@ -0,0 +1,25 @@ +{ pkgs, config, lib, ... }: +with lib; +{ + options.components.terminal.oh-my-posh.enable = mkOption { + type = lib.types.bool; + default = config.components.terminal.enable; + }; + + config = mkIf (config.components.terminal.oh-my-posh.enable) { + + home-manager.users = + let + poshConfig = { + programs.oh-my-posh = { + enable = true; + useTheme = "gruvbox"; + }; + }; + in + { + mainUser = poshConfig; + root = poshConfig; + }; + }; +} diff --git a/nixos/components/terminal/zsh.nix b/nixos/components/terminal/zsh.nix new file mode 100644 index 0000000..1812860 --- /dev/null +++ b/nixos/components/terminal/zsh.nix @@ -0,0 +1,49 @@ +{ pkgs, config, lib, ... }: +with lib; +{ + options.components.terminal.zsh.enable = mkOption { + type = lib.types.bool; + default = config.components.terminal.enable; + }; + + config = mkIf (config.components.terminal.zsh.enable) { + + home-manager.users = + let + zshConfig = { + programs.zsh = { + enable = true; + defaultKeymap = "viins"; + }; + }; + in + { + mainUser = zshConfig; + root = zshConfig; + }; + + programs.zsh = { + + enable = true; + enableCompletion = true; + syntaxHighlighting.enable = true; + + shellAliases = { + ls = "ls --color=tty"; + l = "ls -CFh"; + la = "ls -Ah"; + ll = "ls -lh"; + lt = "ls -lct --reverse"; + less = "less -S"; + top = "htop"; + version = "date '+%Y%m%d%H%M%S'"; + vclip = "xclip -selection clipboard"; + df = "df -h"; + timestamp = "date +%Y%m%d%H%M%S"; + nix-show-garbadge-roots = "ls -lh /nix/var/nix/gcroots/auto/"; + }; + + }; + + }; +} diff --git a/nixos/machines/chungus/configuration.nix b/nixos/machines/chungus/configuration.nix index d1d337c..0cd7ed9 100644 --- a/nixos/machines/chungus/configuration.nix +++ b/nixos/machines/chungus/configuration.nix @@ -72,7 +72,6 @@ networking.hostName = "chungus"; - programs.custom. zsh.enable = true; users.users.root.shell = pkgs.zsh; # todo : rename to component.init.ssh diff --git a/nixos/modules/default.nix b/nixos/modules/default.nix index d28c3ac..74d720b 100644 --- a/nixos/modules/default.nix +++ b/nixos/modules/default.nix @@ -22,8 +22,8 @@ #./programs/ffmpeg.nix #./programs/git.nix ./programs/shell-bash.nix - ./programs/shell-tools.nix - ./programs/shell-zsh.nix + #./programs/shell-tools.nix + #./programs/shell-zsh.nix #./programs/slack.nix ./programs/steam.nix #./programs/taskwarrior.nix diff --git a/nixos/modules/programs/shell-zsh.nix b/nixos/modules/programs/shell-zsh.nix index 0ac83f6..69cb523 100644 --- a/nixos/modules/programs/shell-zsh.nix +++ b/nixos/modules/programs/shell-zsh.nix @@ -22,13 +22,13 @@ in enable = true; enableCompletion = true; - #autosuggestions.enable = true; + syntaxHighlighting.enable = true; ohMyZsh = { custom = "/etc/zshcustom/"; - enable = true; + enable = false; # powerline themes # ---------------- @@ -46,9 +46,10 @@ in ]; }; - loginShellInit = '' - export TERM="xterm-256color" - ''; + #loginShellInit = '' + # export TERM="xterm-256color" + #''; + shellAliases = { ls = "ls --color=tty"; l = "ls -CFh"; @@ -63,106 +64,48 @@ in timestamp = "date +%Y%m%d%H%M%S"; - nix-search = "nix-env -qaP"; - nix-list = ''nix-env -qaP "*" --description''; - nix-list-haskell = ''nix-env -f "" -qaP -A haskellPackages''; - nix-list-node = ''nix-env -f "" -qaP -A nodePackages''; - nix-list-beam = ''nix-env -f "" -qaP -A beamPackages''; - # nix-find = "clear ; ${pkgs.nix-index}/bin/nix-locate -1 -w"; + #nix-search = "nix-env -qaP"; + #nix-list = ''nix-env -qaP "*" --description''; + #nix-list-haskell = ''nix-env -f "" -qaP -A haskellPackages''; + #nix-list-node = ''nix-env -f "" -qaP -A nodePackages''; + #nix-list-beam = ''nix-env -f "" -qaP -A beamPackages''; + #nix-find = "clear ; ${pkgs.nix-index}/bin/nix-locate -1 -w"; nix-show-garbadge-roots = "ls -lh /nix/var/nix/gcroots/auto/"; }; }; - #environment.systemPackages = [ - # pkgs.nix-index # make nix-index also available to users - #]; - # only used to make quick config changes # -------------------------------------- - environment.etc."zshcustom/mainuser.zsh".source = - pkgs.writeText "mainuser-zsh" (if (cfg.mainUser != null) then '' - source ${config.users.users.mainUser.home}/.zshrc - '' else - "# programs.custom.zsh.mainUser not set "); + #environment.etc."zshcustom/mainuser.zsh".source = + # pkgs.writeText "mainuser-zsh" (if (cfg.mainUser != null) then '' + # source ${config.users.users.mainUser.home}/.zshrc + # '' else + # "# programs.custom.zsh.mainUser not set "); # Theme # ----- - # make sure powerline-fonts is set in `fonts.fonts` - - environment.etc."zshcustom/themes/powerlevel9k".source = - pkgs.fetchFromGitHub { - owner = "bhilburn"; - repo = "powerlevel9k"; - rev = "v0.6.4"; - sha256 = "104wvlni3rilpw9v1dk848lnw8cm8qxl64xs70j04ly4s959dyb5"; - }; - environment.etc."zshcustom/powerlevel9kpatch.zsh".source = - pkgs.writeText "powerlevel9kpatch.zsh" '' - - # this shows all the colors which are available - # --------------------------------------------- - # for code ({000..255}) print -P -- "$code: %F{$code}This is how your text would look like%f" - - # prompt elements - # --------------- - POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vi_mode context dir vcs custom_jail background_jobs time status) - POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=() - - # vi mode - # ------- - #POWERLEVEL9K_VI_MODE_INSERT_FOREGROUND="black" - #POWERLEVEL9K_VI_MODE_INSERT_BACKGROUND="blue" - #POWERLEVEL9K_VI_MODE_NORMAL_FOREGROUND="black" - #POWERLEVEL9K_VI_MODE_NORMAL_BACKGROUND="yellow" - - # context - # ------- - #POWERLEVEL9K_CONTEXT_DEFAULT_FOREGROUND="green" - #POWERLEVEL9K_CONTEXT_DEFAULT_BACKGROUND="008" - #POWERLEVEL9K_CONTEXT_ROOT_FOREGROUND="008" - #POWERLEVEL9K_CONTEXT_ROOT_BACKGROUND="red" - #POWERLEVEL9K_CONTEXT_REMOTE_FOREGROUND="008" - #POWERLEVEL9K_CONTEXT_REMOTE_BACKGROUND="red" - - # dir - # --- - #POWERLEVEL9K_DIR_HOME_FOREGROUND="black" - #POWERLEVEL9K_DIR_HOME_BACKGROUND="yellow" - #POWERLEVEL9K_DIR_HOME_SUBFOLDER_FOREGROUND="black" - #POWERLEVEL9K_DIR_HOME_SUBFOLDER_BACKGROUND="yellow" - #POWERLEVEL9K_DIR_DEFAULT_FOREGROUND="black" - #POWERLEVEL9K_DIR_DEFAULT_BACKGROUND="green" - - # root_indicator - # -------------- - #POWERLEVEL9K_ROOT_ICON="#" - #POWERLEVEL9K_ROOT_INDICATOR_FOREGROUND="black" - #POWERLEVEL9K_ROOT_INDICATOR_BACKGROUND="red" - - # background_jobs - # --------------- - POWERLEVEL9K_BACKGROUND_JOBS_ICON="" - - # status - # ------ - #POWERLEVEL9K_STATUS_OK_BACKGROUND="008" - #POWERLEVEL9K_STATUS_ERROR_BACKGROUND="008" - - # time - # ---- - #POWERLEVEL9K_TIME_FOREGROUND="008" - #POWERLEVEL9K_TIME_BACKGROUND="006" - - - # jail indicator - # -------------- - POWERLEVEL9K_CUSTOM_JAIL="[ -z $JAIL ] || echo $JAIL" - POWERLEVEL9K_CUSTOM_JAIL_BACKGROUND="red" - POWERLEVEL9K_CUSTOM_JAIL_FOREGROUND="black" - - ''; + #environment.etc."zshcustom/themes/powerlevel9k".source = + # pkgs.fetchFromGitHub { + # owner = "bhilburn"; + # repo = "powerlevel9k"; + # rev = "v0.6.4"; + # sha256 = "104wvlni3rilpw9v1dk848lnw8cm8qxl64xs70j04ly4s959dyb5"; + # }; + #environment.etc."zshcustom/powerlevel9kpatch.zsh".source = + # pkgs.writeText "powerlevel9kpatch.zsh" '' + # # prompt elements + # # --------------- + # POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vi_mode context dir vcs custom_jail background_jobs time status) + # POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=() + # + # # root_indicator + # # -------------- + # POWERLEVEL9K_ROOT_ICON="#" + # POWERLEVEL9K_ROOT_INDICATOR_FOREGROUND="black" + # POWERLEVEL9K_ROOT_INDICATOR_BACKGROUND="red" + # ''; }; } diff --git a/nixos/system/all/default.nix b/nixos/system/all/default.nix index de0bf74..9c25ce9 100644 --- a/nixos/system/all/default.nix +++ b/nixos/system/all/default.nix @@ -33,7 +33,7 @@ # ------------------- programs.custom = { bash.enable = true; - zsh.enable = true; + #zsh.enable = true; }; # This value determines the NixOS release with which your system is to be diff --git a/nixos/system/desktop/default.nix b/nixos/system/desktop/default.nix index 5c785d1..5f3202b 100644 --- a/nixos/system/desktop/default.nix +++ b/nixos/system/desktop/default.nix @@ -33,7 +33,6 @@ colorTheme = "light"; }; - shellTools.enable = true; curlScripts.enable = true; citate.enable = true; vim.enable = true;