From 305f8706e0c622741564840c06d1bad570a89d98 Mon Sep 17 00:00:00 2001 From: 0xrsydn Date: Wed, 1 Oct 2025 10:54:05 +0700 Subject: [PATCH] fix: nushell oh my posh prompt config --- modules/home/rsydn/shell/nushell.nix | 23 +++++++++++++++++++ .../rsydn/shell/oh-my-posh/capr4n.omp.json | 13 +++++++++++ 2 files changed, 36 insertions(+) diff --git a/modules/home/rsydn/shell/nushell.nix b/modules/home/rsydn/shell/nushell.nix index 52c4c5d..5fd07cb 100644 --- a/modules/home/rsydn/shell/nushell.nix +++ b/modules/home/rsydn/shell/nushell.nix @@ -3,9 +3,32 @@ let themeName = "capr4n.omp.json"; themeSource = ./oh-my-posh/capr4n.omp.json; themeConfigPath = "${config.xdg.configHome}/oh-my-posh/${themeName}"; + profileBin = "${config.home.profileDirectory}/bin"; + systemBin = "/run/current-system/sw/bin"; + defaultBin = "/nix/var/nix/profiles/default/bin"; in { programs.nushell.enable = lib.mkDefault true; + programs.nushell.envFile.text = '' + let nix_paths = [ + "${profileBin}" + "${systemBin}" + "${defaultBin}" + ] + + if ($env.PATH? == null) { + $env.PATH = $nix_paths + } else { + for path in $nix_paths { + if not ($env.PATH | any {|it| $it == $path}) { + $env.PATH = ($env.PATH | append $path) + } + } + } + + $env.NIX_PROFILES = "/run/current-system/sw ${config.home.profileDirectory}" + ''; + programs.oh-my-posh = { enable = lib.mkDefault true; enableNushellIntegration = lib.mkDefault true; diff --git a/modules/home/rsydn/shell/oh-my-posh/capr4n.omp.json b/modules/home/rsydn/shell/oh-my-posh/capr4n.omp.json index 7926528..b8fdd0e 100644 --- a/modules/home/rsydn/shell/oh-my-posh/capr4n.omp.json +++ b/modules/home/rsydn/shell/oh-my-posh/capr4n.omp.json @@ -62,6 +62,19 @@ } ], "type": "prompt" + }, + { + "alignment": "left", + "newline": true, + "segments": [ + { + "foreground": "#61AFEF", + "style": "plain", + "template": "❯ ", + "type": "text" + } + ], + "type": "prompt" } ], "console_title_template": "{{if .Root}} \u26a1 {{end}}{{.UserName}} \u2794 📁{{.Folder}}",