mirror of
https://github.com/nix-community/home-manager
synced 2025-01-11 19:49:49 +01:00
starship: use formats.toml to generate configuration
This commit is contained in:
parent
040ea28e44
commit
a4e146693e
1 changed files with 4 additions and 12 deletions
|
@ -6,16 +6,7 @@ let
|
||||||
|
|
||||||
cfg = config.programs.starship;
|
cfg = config.programs.starship;
|
||||||
|
|
||||||
configFile = config:
|
tomlFormat = pkgs.formats.toml { };
|
||||||
pkgs.runCommand "config.toml" {
|
|
||||||
buildInputs = [ pkgs.remarshal ];
|
|
||||||
preferLocalBuild = true;
|
|
||||||
allowSubstitutes = false;
|
|
||||||
} ''
|
|
||||||
remarshal -if json -of toml \
|
|
||||||
< ${pkgs.writeText "config.json" (builtins.toJSON config)} \
|
|
||||||
> $out
|
|
||||||
'';
|
|
||||||
|
|
||||||
in {
|
in {
|
||||||
meta.maintainers = [ maintainers.marsam ];
|
meta.maintainers = [ maintainers.marsam ];
|
||||||
|
@ -93,8 +84,9 @@ in {
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
home.packages = [ cfg.package ];
|
home.packages = [ cfg.package ];
|
||||||
|
|
||||||
xdg.configFile."starship.toml" =
|
xdg.configFile."starship.toml" = mkIf (cfg.settings != { }) {
|
||||||
mkIf (cfg.settings != { }) { source = configFile cfg.settings; };
|
source = tomlFormat.generate "starship-config" cfg.settings;
|
||||||
|
};
|
||||||
|
|
||||||
programs.bash.initExtra = mkIf cfg.enableBashIntegration ''
|
programs.bash.initExtra = mkIf cfg.enableBashIntegration ''
|
||||||
if [[ $TERM != "dumb" && (-z $INSIDE_EMACS || $INSIDE_EMACS == "vterm") ]]; then
|
if [[ $TERM != "dumb" && (-z $INSIDE_EMACS || $INSIDE_EMACS == "vterm") ]]; then
|
||||||
|
|
Loading…
Reference in a new issue