Migrate to ohmyposh prompt

This commit is contained in:
Christopher Mühl 2025-08-04 17:35:15 +02:00
parent 1a50d85036
commit 1fc8b9290d
No known key found for this signature in database
GPG key ID: E919B0F59E14FD47
6 changed files with 127 additions and 51 deletions

6
flake.lock generated
View file

@ -357,11 +357,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1751986323, "lastModified": 1754263839,
"narHash": "sha256-EuYWd8FMsqAiAtrAB34LBDe8wgixhMtx1O75fprygX0=", "narHash": "sha256-ck7lILfCNuunsLvExPI4Pw9OOCJksxXwozum24W8b+8=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "5751fa774fa61837f35efb82f3b6e105d4c63ced", "rev": "1d7abbd5454db97e0af51416f4960b3fb64a4773",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -47,6 +47,7 @@
}; };
inputs = { inputs = {
# nixpkgs.url = "git+file:///home/christopher/code/opensource/nixpkgs";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
# Opinionated flake library for better organization without much boilerplate # Opinionated flake library for better organization without much boilerplate
@ -60,6 +61,7 @@
darwin.inputs.nixpkgs.follows = "nixpkgs"; darwin.inputs.nixpkgs.follows = "nixpkgs";
home-manager = { home-manager = {
# url = "git+file:///home/christopher/code/opensource/home-manager";
url = "github:nix-community/home-manager"; url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };

View file

@ -6,6 +6,7 @@ in {
imports = [ imports = [
./programs ./programs
./shell/aliases.nix ./shell/aliases.nix
./shell/prompt.nix
./shell/nu ./shell/nu
./shell/zsh ./shell/zsh
]; ];

View file

@ -0,0 +1,121 @@
{...}: let
unicode = code: builtins.fromJSON ''"${code}" '';
in {
programs.oh-my-posh = {
enable = true;
enableNushellIntegration = true;
enableZshIntegration = true;
# Original settings taken from `catppuccin_frappe`, and adjusted to my
# likings and usage.
settings = {
"$schema" = "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json";
version = 3;
final_space = true;
palette = {
os = "#acb0be";
closer = "p:blue";
pink = "#f4b8e4";
lavender = "#babbf1";
blue = "#8caaee";
red = "#e78284";
surface = "#414559";
};
blocks = [
{
alignment = "left";
type = "prompt";
newline = true;
segments = [
{
foreground = "p:os";
style = "plain";
template = "{{ .Icon }} ";
type = "os";
}
{
foreground = "p:pink";
style = "plain";
template = "{{ .Path }} ";
type = "path";
properties = {
home_icon = "~";
style = "full";
mapped_locations = {
"~/code/hausgold/env/projects" = "hg-env";
"~/code/hausgold" = "hg";
"~/code/opensource" = "oss";
"~/code/own" = "own";
};
};
}
{
foreground = "p:blue";
style = "plain";
template = "{{ .UserName }}@{{ .HostName }} ";
type = "session";
}
{
foreground = "p:lavender";
template = "{{ .HEAD }} ";
style = "plain";
type = "git";
properties = {
branch_icon = unicode "\\ue725 ";
cherry_pick_icon = unicode "\\ue29b ";
commit_icon = unicode "\\uf417 ";
merge_icon = unicode "\\ue727 ";
no_commits_icon = unicode "\\uef0c3 ";
rebase_icon = unicode "\\ue728 ";
revert_icon = unicode "\\uf0e2 ";
tag_icon = unicode "\\uf412 ";
fetch_status = false;
fetch_upstream_icon = false;
};
}
];
}
{
alignment = "right";
type = "prompt";
segments = [
{
foreground = "p:red";
background = "p:surface";
style = "plain";
template = unicode "{{ if .Error }}\\uf06d {{ .String }}{{ end }}";
type = "status";
properties = {
always_enabled = true;
};
}
{
foreground = "p:pink";
style = "plain";
template = " {{ .FormattedMs }}";
type = "executiontime";
properties = {
style = "austin";
};
}
];
}
{
alignment = "left";
type = "prompt";
newline = true;
segments = [
{
foreground = "p:closer";
template = "#";
style = "plain";
type = "text";
}
];
}
];
};
};
}

View file

@ -5,14 +5,12 @@
}: { }: {
imports = [ imports = [
./antigen.nix ./antigen.nix
./prompt.nix
]; ];
programs.zoxide.enableZshIntegration = true; programs.zoxide.enableZshIntegration = true;
programs.zsh = { programs.zsh = {
enable = true; enable = true;
dotDir = ".config/zsh";
oh-my-zsh.enable = true; oh-my-zsh.enable = true;
shellAliases = config.home.shellAliases; shellAliases = config.home.shellAliases;

View file

@ -1,46 +0,0 @@
{
programs.starship.enable = true;
# (https://starship.rs/guide/)
# Define a Pure-ish prompt
programs.starship.settings = {
format = ''
$username$hostname$directory$git_branch$git_state$git_status$cmd_duration$line_break$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)](218) ($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";
};
};
}