{ lib, config, pkgs, flakeRoot, ... }: let # Default username fallback username = config.defaultUser or "henrov"; # Path to optional per-user generated zshrc generatedZsh = "${flakeRoot}/generated/.config/zsh/.zshrc"; in { ################################# # Install Zsh, Oh My Zsh, and Starship system-wide ################################# environment.systemPackages = with pkgs; [ zsh oh-my-zsh starship ]; ################################# # Set Zsh to use ~/.config/zsh as its config directory ################################# environment.etc."zshenv".text = '' export ZDOTDIR=$HOME/.config/zsh ''; ################################# # Deploy global zshrc for all users ################################# environment.etc."zshrc".text = '' export ZSH=${pkgs.oh-my-zsh}/share/oh-my-zsh ZSH_THEME="" plugins=(git sudo extract colored-man-pages command-not-found history docker kubectl) source $ZSH/oh-my-zsh.sh # Load optional per-user generated zshrc if it exists [ -f "${generatedZsh}" ] && source "${generatedZsh}" # Initialize Starship prompt eval "$(starship init zsh)" ''; ################################# # Set Zsh as default login shell for the user via Home Manager ################################# home-manager.users = { ${username} = { programs.zsh.enable = true; # Include the generated zshrc if you want home.file.".config/zsh/.zshrc".source = generatedZsh; }; }; }