Enable transience feature for starship.

This commit is contained in:
ulic-youthlic 2025-06-05 09:28:57 +08:00
parent a3edfa91e9
commit c538cb8211
Signed by: youthlic
GPG key ID: 63E86C3C14A0D721

View file

@ -4,27 +4,40 @@
... ...
}: let }: let
cfg = config.youthlic.programs.starship; cfg = config.youthlic.programs.starship;
fish-cfg = config.youthlic.programs.fish;
bash-cfg = config.youthlic.programs.bash;
in { in {
options = { options = {
youthlic.programs.starship = { youthlic.programs.starship = {
enable = lib.mkEnableOption "starship"; enable = lib.mkEnableOption "starship";
}; };
}; };
config = lib.mkIf cfg.enable { config = lib.mkMerge [
programs.starship = lib.mkMerge [ (
{ lib.mkIf cfg.enable {
enable = true; programs.starship = {
settings = let enable = true;
config-file = builtins.readFile ./config.toml; enableTransience = true;
in settings = let
builtins.fromTOML config-file; config-file = builtins.readFile ./config.toml;
in
builtins.fromTOML config-file;
};
} }
(lib.mkIf config.youthlic.programs.fish.enable { )
enableFishIntegration = true; (lib.mkIf (cfg.enable && fish-cfg.enable) {
}) programs.starship.enableFishIntegration = true;
(lib.mkIf config.youthlic.programs.bash.enable { programs.fish.functions = {
enableBashIntegration = true; starship_transient_prompt_func = ''
}) starship module character
]; '';
}; starship_transient_rprompt_func = ''
starship module time
'';
};
})
(lib.mkIf (cfg.enable && bash-cfg.enable) {
programs.starship.enableBashIntegration = true;
})
];
} }