Files
nixos/Droidnix/generated/modules/traveldroid/apps/zsh.nix
T
2026-04-12 12:24:14 +02:00

55 lines
1.8 KiB
Nix

# --- This file has been auto-generated. For permanent changes alter the appropriate block in the README.org. ---
# --- This file has been auto-generated. For permanent changes alter the appropriate block in the README.org. ---
{ lib, config, pkgs, flakeRoot, ... }:
let
username = config.defaultUser or "henrov";
generatedZsh = "${flakeRoot}/generated/.config/zsh/.zshrc";
in
{
#################################
# Install Zsh, Oh My Zsh, Starship and syntax highlighting system-wide
#################################
environment.systemPackages = with pkgs; [
zsh
oh-my-zsh
starship
zsh-syntax-highlighting
];
#################################
# 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)"
# Syntax highlighting must be sourced last
source ${pkgs.zsh-syntax-highlighting}/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
'';
#################################
# Set Zsh as default login shell for the user via Home Manager
#################################
home-manager.users = {
${username} = {
programs.zsh.enable = true;
home.file.".config/zsh/.zshrc".source = generatedZsh;
};
};
}