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:
parent
e8c19a3cec
commit
460f1e9af9
2 changed files with 21 additions and 3 deletions
|
|
@ -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 ''
|
||||
|
|
|
|||
|
|
@ -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}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue