# --- This file has been auto-generated. For permanent changes alter the appropriate block in the README.org. --- { lib, config, pkgs, flakeRoot, ... }: let ################################# # User config ################################# username = config.defaultUser or "henrov"; generatedZsh = "${flakeRoot}/generated/.config/zsh/.zshrc"; ################################# # Alias parsing ################################# aliasFile = "${flakeRoot}/generated/assets/aliases.conf"; content = builtins.readFile aliasFile; lines = lib.filter (l: l != "") (map (l: let noComment = builtins.head (lib.splitString "#" l); in lib.trim noComment ) (lib.splitString "\n" content)); parseLine = line: let parts = lib.splitString "=" line; in if lib.length parts < 2 then null else { name = lib.trim (lib.head parts); value = lib.trim (lib.concatStringsSep "=" (lib.tail parts)); }; parsed = lib.filter (x: x != null) (map parseLine lines); functions = lib.concatStringsSep "\n" (map (x: '' ${x.name}() { ${x.value} "$@" } '') parsed); in { ################################# # Packages ################################# environment.systemPackages = with pkgs; [ zsh oh-my-zsh starship zsh-syntax-highlighting ]; ################################# # Zsh config location ################################# environment.etc."zshenv".text = '' export ZDOTDIR=$HOME/.config/zsh ''; ################################# # Generated alias functions (system-wide) ################################# environment.etc."profile.d/99-alias-functions.sh".text = '' # system-wide functions generated from aliases.conf ${functions} ''; ################################# # Global zshrc ################################# 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 # Init starship FIRST (prompt) eval "$(starship init zsh)" # Load alias functions if [ -f /etc/profile.d/99-alias-functions.sh ]; then source /etc/profile.d/99-alias-functions.sh fi # Load optional generated user config [ -f "${generatedZsh}" ] && source "${generatedZsh}" # Syntax highlighting MUST be last source ${pkgs.zsh-syntax-highlighting}/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh ''; ################################# # Home Manager integration ################################# home-manager.users.${username} = { programs.zsh.enable = true; home.file.".config/zsh/.zshrc".source = generatedZsh; }; }