Loading nixos/modules/programs/starship.nix +25 −8 Original line number Diff line number Diff line { config, lib, pkgs, ... }: with lib; let cfg = config.programs.starship; settingsFormat = pkgs.formats.toml { }; settingsFile = settingsFormat.generate "starship.toml" cfg.settings; userSettingsFile = settingsFormat.generate "starship.toml" cfg.settings; settingsFile = if cfg.presets == [] then userSettingsFile else pkgs.runCommand "starship.toml" { nativeBuildInputs = [ pkgs.yq ]; } '' tomlq -s -t 'reduce .[] as $item ({}; . * $item)' \ ${lib.concatStringsSep " " (map (f: "${pkgs.starship}/share/starship/presets/${f}.toml") cfg.presets)} \ ${userSettingsFile} \ > $out ''; initOption = if cfg.interactiveOnly then Loading @@ -18,19 +26,28 @@ let in { options.programs.starship = { enable = mkEnableOption (lib.mdDoc "the Starship shell prompt"); enable = lib.mkEnableOption (lib.mdDoc "the Starship shell prompt"); interactiveOnly = mkOption { interactiveOnly = lib.mkOption { default = true; example = false; type = types.bool; type = lib.types.bool; description = lib.mdDoc '' Whether to enable starship only when the shell is interactive. Some plugins require this to be set to false to function correctly. ''; }; settings = mkOption { presets = lib.mkOption { default = [ ]; example = [ "nerd-font-symbols" ]; type = with lib.types; listOf str; description = lib.mdDoc '' Presets files to be merged with settings in order. ''; }; settings = lib.mkOption { inherit (settingsFormat) type; default = { }; description = lib.mdDoc '' Loading @@ -41,7 +58,7 @@ in }; }; config = mkIf cfg.enable { config = lib.mkIf cfg.enable { programs.bash.${initOption} = '' if [[ $TERM != "dumb" ]]; then # don't set STARSHIP_CONFIG automatically if there's a user-specified Loading Loading
nixos/modules/programs/starship.nix +25 −8 Original line number Diff line number Diff line { config, lib, pkgs, ... }: with lib; let cfg = config.programs.starship; settingsFormat = pkgs.formats.toml { }; settingsFile = settingsFormat.generate "starship.toml" cfg.settings; userSettingsFile = settingsFormat.generate "starship.toml" cfg.settings; settingsFile = if cfg.presets == [] then userSettingsFile else pkgs.runCommand "starship.toml" { nativeBuildInputs = [ pkgs.yq ]; } '' tomlq -s -t 'reduce .[] as $item ({}; . * $item)' \ ${lib.concatStringsSep " " (map (f: "${pkgs.starship}/share/starship/presets/${f}.toml") cfg.presets)} \ ${userSettingsFile} \ > $out ''; initOption = if cfg.interactiveOnly then Loading @@ -18,19 +26,28 @@ let in { options.programs.starship = { enable = mkEnableOption (lib.mdDoc "the Starship shell prompt"); enable = lib.mkEnableOption (lib.mdDoc "the Starship shell prompt"); interactiveOnly = mkOption { interactiveOnly = lib.mkOption { default = true; example = false; type = types.bool; type = lib.types.bool; description = lib.mdDoc '' Whether to enable starship only when the shell is interactive. Some plugins require this to be set to false to function correctly. ''; }; settings = mkOption { presets = lib.mkOption { default = [ ]; example = [ "nerd-font-symbols" ]; type = with lib.types; listOf str; description = lib.mdDoc '' Presets files to be merged with settings in order. ''; }; settings = lib.mkOption { inherit (settingsFormat) type; default = { }; description = lib.mdDoc '' Loading @@ -41,7 +58,7 @@ in }; }; config = mkIf cfg.enable { config = lib.mkIf cfg.enable { programs.bash.${initOption} = '' if [[ $TERM != "dumb" ]]; then # don't set STARSHIP_CONFIG automatically if there's a user-specified Loading