This commit is contained in:
kenji
2025-08-13 08:51:56 -05:00
parent 58b144792e
commit c502d301b8
+70 -21
View File
@@ -1,43 +1,92 @@
{ {
config, config,
lib, lib,
inputs,
pkgs,
... ...
}: let }: let
inherit
(lib)
mkIf
mkOption
types
;
cfg = config.programs.illogical-impulse; cfg = config.programs.illogical-impulse;
in { in {
options = { options = {
programs.illogical-impulse = { programs.illogical-impulse = {
enable = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Enable the illogical-impulse program module.";
};
settings = { settings = {
simpleStarship = { simpleStarship = {
enable = mkOption { enable = lib.mkOption {
type = types.bool; type = lib.types.bool;
default = false; default = false;
description = '' description = "Uses a custom pure-like starship configuration.";
Uses Pure starship.
'';
}; };
}; };
}; };
}; };
}; };
config = mkIf cfg.enable { config = lib.mkIf cfg.enable {
imports = lib.mkIf cfg.settings.simpleStarship [ programs.starship = lib.mkIf cfg.settings.simpleStarship.enable {
./simple-starship.nix enable = true;
]; settings = {
format = lib.concatStrings [
home.file = { "$username"
".config/starship.toml" = mkIf (!cfg.settings.simpleStarship) { "$hostname"
source = builtins.path {path = ../../.config/starship.toml;}; "$directory"
"$git_branch"
"$git_state"
"$git_status"
"$cmd_duration"
"$line_break"
"$python"
"$character"
];
directory = {
style = "blue";
};
character = {
success_symbol = "[](purple)";
error_symbol = "[](red)";
vimcmd_symbol = "[](green)";
};
git_branch = {
format = "[$branch]($style)";
style = "bright-black";
};
git_status = {
format = "[(*$conflicted$untracked$modified$staged$renamed$deleted) $ahead_behind$stashed]($style)";
style = "cyan";
conflicted = "";
untracked = "";
modified = "";
staged = "";
renamed = "";
deleted = "";
stashed = "";
};
git_state = {
format = "([$state( $progress_current/$progress_total)]($style)) ";
style = "bright-black";
};
cmd_duration = {
format = "[$duration]($style) ";
style = "yellow";
};
python = {
format = "[$virtualenv]($style) ";
style = "bright-black";
};
}; };
}; };
home.file.".config/starship.toml" = lib.mkIf (!cfg.settings.simpleStarship.enable) {
source = builtins.path {path = ../../.config/starship.toml;};
};
}; };
assertions = [
{
assertion = !(cfg.settings.simpleStarship.enable && !cfg.enable);
message = "The 'simpleStarship' setting cannot be enabled if 'illogical-impulse' is disabled.";
}
];
} }