initial
This commit is contained in:
106
hosts/dunamis/users/work/programs/shell/oh-my-posh.nix
Normal file
106
hosts/dunamis/users/work/programs/shell/oh-my-posh.nix
Normal file
@ -0,0 +1,106 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.shell.oh-my-posh;
|
||||
in {
|
||||
options = {
|
||||
shell.oh-my-posh.enable =
|
||||
mkEnableOption "enable oh my posh";
|
||||
};
|
||||
config = mkIf cfg.enable {
|
||||
programs.oh-my-posh = {
|
||||
enable = true;
|
||||
settings = {
|
||||
version = 2;
|
||||
final_space = true;
|
||||
console_title_template = "{{ .Shell }} in {{ .Folder }}";
|
||||
blocks = [
|
||||
{
|
||||
type = "prompt";
|
||||
alignment = "left";
|
||||
newline = true;
|
||||
segments = [
|
||||
{
|
||||
type = "path";
|
||||
style = "plain";
|
||||
background = "transparent";
|
||||
foreground = "blue";
|
||||
template = "{{ .Path }}";
|
||||
properties = {
|
||||
style = "full";
|
||||
};
|
||||
}
|
||||
{
|
||||
type = "text";
|
||||
style = "plain";
|
||||
background = "transparent";
|
||||
template = "{{ if .Env.BW_SESSION }} {{ end }}";
|
||||
}
|
||||
{
|
||||
type = "nix-shell";
|
||||
style = "plain";
|
||||
background = "transparent";
|
||||
template = "{{ if ne .Type \"unknown\" }} {{ end }}";
|
||||
}
|
||||
{
|
||||
type = "git";
|
||||
style = "plain";
|
||||
foreground = "p:grey";
|
||||
background = "transparent";
|
||||
template = " {{ .HEAD }}{{ if or (.Working.Changed) (.Staging.Changed) }}*{{ end }} <cyan>{{ if gt .Behind 0 }}⇣{{ end }}{{ if gt .Ahead 0 }}⇡{{ end }}</>";
|
||||
properties = {
|
||||
branch_icon = "";
|
||||
commit_icon = "@";
|
||||
fetch_status = true;
|
||||
};
|
||||
}
|
||||
];
|
||||
}
|
||||
{
|
||||
type = "rprompt";
|
||||
overflow = "hidden";
|
||||
segments = [
|
||||
{
|
||||
type = "executiontime";
|
||||
style = "plain";
|
||||
foreground = "yellow";
|
||||
background = "transparent";
|
||||
template = "{{ .FormattedMs }}";
|
||||
properties = {
|
||||
threshold = 5000;
|
||||
};
|
||||
}
|
||||
];
|
||||
}
|
||||
{
|
||||
type = "prompt";
|
||||
alignment = "left";
|
||||
newline = true;
|
||||
segments = [
|
||||
{
|
||||
type = "text";
|
||||
style = "plain";
|
||||
foreground_templates = ["{{if gt .Code 0}}red{{end}}" "{{if eq .Code 0}}magenta{{end}}"];
|
||||
background = "transparent";
|
||||
template = "❯";
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
transient_prompt = {
|
||||
foreground_templates = ["{{if gt .Code 0}}red{{end}}" "{{if eq .Code 0}}magenta{{end}}"];
|
||||
background = "transparent";
|
||||
template = "❯ ";
|
||||
};
|
||||
secondary_prompt = {
|
||||
foreground = "magenta";
|
||||
background = "transparent";
|
||||
template = "❯❯ ";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user