1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-11-08 19:46:05 +01:00

starship: set STARSHIP_CONFIG var and add option to set config path (#7435)

This commit is contained in:
Ryan Horiguchi 2025-07-17 17:59:05 +02:00 committed by GitHub
parent e8c19a3cec
commit 460f1e9af9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 21 additions and 3 deletions

View file

@ -82,13 +82,26 @@ in
https://starship.rs/advanced-config/#transientprompt-and-transientrightprompt-in-cmd
'';
};
configPath = mkOption {
type = lib.types.str;
default = "${config.xdg.configHome}/starship.toml";
defaultText = lib.literalExpression "\${config.xdg.configHome}/starship.toml";
description = ''
Relative path to the user's home directory where the Starship config should be stored.
'';
};
};
config = mkIf cfg.enable {
home.packages = [ cfg.package ];
home = {
packages = [ cfg.package ];
xdg.configFile."starship.toml" = mkIf (cfg.settings != { }) {
source = tomlFormat.generate "starship-config" cfg.settings;
sessionVariables.STARSHIP_CONFIG = cfg.configPath;
file.${cfg.configPath} = mkIf (cfg.settings != { }) {
source = tomlFormat.generate "starship-config" cfg.settings;
};
};
programs.bash.initExtra = mkIf cfg.enableBashIntegration ''

View file

@ -46,6 +46,11 @@
};
nmt.script = ''
sessionVarsFile=home-path/etc/profile.d/hm-session-vars.sh
assertFileExists $sessionVarsFile
assertFileContains $sessionVarsFile \
'export STARSHIP_CONFIG="/home/hm-user/.config/starship.toml"'
assertFileContent \
home-files/.config/starship.toml \
${./settings-expected.toml}