52 lines
1.3 KiB
Nix
52 lines
1.3 KiB
Nix
{
|
||
config,
|
||
pkgs,
|
||
lib,
|
||
user,
|
||
...
|
||
}:
|
||
{
|
||
# NixOS: Install Starship system-wide (optional)
|
||
environment.systemPackages = with pkgs; [ starship ];
|
||
|
||
# Home Manager: Configure Starship for the user
|
||
home-manager.users.${user.username} = {
|
||
programs.starship = {
|
||
enable = true; # Enables Starship and adds init to shell configs
|
||
# Simple settings (flat Nix attributes)
|
||
settings = {
|
||
add_newline = false;
|
||
};
|
||
};
|
||
|
||
# Provide a full starship.toml via xdg.configFile
|
||
xdg.configFile."starship.toml".text = ''
|
||
format = "$all"
|
||
|
||
[character]
|
||
success_symbol = "[❯](bold green)"
|
||
error_symbol = "[❯](bold red)"
|
||
vicmd_symbol = "[❮](bold blue)"
|
||
|
||
[directory]
|
||
truncation_length = 3
|
||
style = "bold blue"
|
||
|
||
[git_branch]
|
||
symbol = " "
|
||
style = "bold purple"
|
||
format = "[$symbol$branch]($style) "
|
||
'';
|
||
|
||
# Optional: Manually ensure Starship init is in shell configs
|
||
xdg.configFile."bashrc".text = lib.concatStringsSep "\n" [
|
||
"${config.programs.starship.extraInit}"
|
||
"eval \"$(starship init bash)\""
|
||
];
|
||
xdg.configFile."zshrc".text = lib.concatStringsSep "\n" [
|
||
"${config.programs.starship.extraInit}"
|
||
"eval \"$(starship init zsh)\""
|
||
];
|
||
};
|
||
}
|