From a4e146693edb4fe24f448a008ec984184542df34 Mon Sep 17 00:00:00 2001 From: Mario Rodas Date: Sat, 13 Mar 2021 04:20:00 +0000 Subject: [PATCH] starship: use formats.toml to generate configuration --- modules/programs/starship.nix | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/modules/programs/starship.nix b/modules/programs/starship.nix index 12a0b88fa..33db8e6d6 100644 --- a/modules/programs/starship.nix +++ b/modules/programs/starship.nix @@ -6,16 +6,7 @@ let cfg = config.programs.starship; - configFile = config: - pkgs.runCommand "config.toml" { - buildInputs = [ pkgs.remarshal ]; - preferLocalBuild = true; - allowSubstitutes = false; - } '' - remarshal -if json -of toml \ - < ${pkgs.writeText "config.json" (builtins.toJSON config)} \ - > $out - ''; + tomlFormat = pkgs.formats.toml { }; in { meta.maintainers = [ maintainers.marsam ]; @@ -93,8 +84,9 @@ in { config = mkIf cfg.enable { home.packages = [ cfg.package ]; - xdg.configFile."starship.toml" = - mkIf (cfg.settings != { }) { source = configFile cfg.settings; }; + xdg.configFile."starship.toml" = mkIf (cfg.settings != { }) { + source = tomlFormat.generate "starship-config" cfg.settings; + }; programs.bash.initExtra = mkIf cfg.enableBashIntegration '' if [[ $TERM != "dumb" && (-z $INSIDE_EMACS || $INSIDE_EMACS == "vterm") ]]; then