From 46db1ed6ef309c2133a60fe5ff8a980dfe465446 Mon Sep 17 00:00:00 2001 From: Felix Schneider <99918022+trueberryless@users.noreply.github.com> Date: Sun, 21 Sep 2025 12:17:02 +0200 Subject: [PATCH] feat: oh-my-posh shell segment, more node versions (20, 22, 24) --- dotfiles/.zshrc | 2 +- dotfiles/oh-my-posh.omp.json | 61 ++++++++++++++++++++++++++++++++++++ modules/apps.nix | 13 +++++--- modules/home-manager.nix | 3 +- modules/shells/node20.nix | 4 ++- modules/shells/node22.nix | 19 +++++++++++ modules/shells/node24.nix | 19 +++++++++++ 7 files changed, 114 insertions(+), 7 deletions(-) create mode 100644 dotfiles/oh-my-posh.omp.json create mode 100644 modules/shells/node22.nix create mode 100644 modules/shells/node24.nix diff --git a/dotfiles/.zshrc b/dotfiles/.zshrc index e5309c2..374b26d 100644 --- a/dotfiles/.zshrc +++ b/dotfiles/.zshrc @@ -1,5 +1,5 @@ export LANG='en_US.UTF-8' if [ "$TERM_PROGRAM" != "Apple_Terminal" ]; then - eval "$(oh-my-posh init zsh --config 'https://github.com/JanDeDobbeleer/oh-my-posh/blob/main/themes/zash.omp.json')" + eval "$(oh-my-posh init zsh --config '/Users/trueberryless/oh-my-posh.omp.json')" eval "$(zoxide init zsh --cmd cd)" fi diff --git a/dotfiles/oh-my-posh.omp.json b/dotfiles/oh-my-posh.omp.json new file mode 100644 index 0000000..cfc5048 --- /dev/null +++ b/dotfiles/oh-my-posh.omp.json @@ -0,0 +1,61 @@ +{ + "$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json", + "blocks": [ + { + "alignment": "left", + "segments": [ + { + "foreground": "#E36464", + "style": "plain", + "template": "@{{ .UserName }} ", + "type": "session" + }, + { + "foreground": "#62ED8B", + "style": "plain", + "template": "\u279c", + "type": "text" + }, + { + "foreground": "#FFD700", + "style": "plain", + "template": "{{ with (env \"DEV_SHELL\") }} {{ . }} {{ end }}", + "type": "text" + }, + { + "foreground": "#62ED8B", + "style": "plain", + "template": "{{ with (env \"DEV_SHELL\") }}\u279c{{ end }}", + "type": "text" + }, + { + "foreground": "#56B6C2", + "properties": { + "style": "folder" + }, + "style": "plain", + "template": " {{ .Path }}", + "type": "path" + }, + { + "foreground": "#D4AAFC", + "properties": { + "branch_icon": "" + }, + "style": "plain", + "template": " <#DDB15F>git({{ .HEAD }}<#DDB15F>)", + "type": "git" + }, + { + "foreground": "#DCB977", + "style": "plain", + "template": " \uf119", + "type": "status" + } + ], + "type": "prompt" + } + ], + "final_space": true, + "version": 3 +} \ No newline at end of file diff --git a/modules/apps.nix b/modules/apps.nix index a5d6a2b..e635fcd 100644 --- a/modules/apps.nix +++ b/modules/apps.nix @@ -1,5 +1,12 @@ { pkgs, ... }: -{ +let + devShellPaths = [ + ./shells/node20.nix + ./shells/node22.nix + ./shells/node24.nix + ]; + devShells = map (path: pkgs.callPackage path { }) devShellPaths; +in { environment.systemPackages = (with pkgs; [ aldente @@ -14,9 +21,7 @@ tmux tree zoxide - ]) ++ [ - (import ./shells/node20.nix { inherit pkgs; }) - ]; + ]) ++ devShells; # Allow unfree packages nixpkgs.config.allowUnfree = true; diff --git a/modules/home-manager.nix b/modules/home-manager.nix index 2620cd8..89a06d7 100644 --- a/modules/home-manager.nix +++ b/modules/home-manager.nix @@ -11,7 +11,8 @@ ]; home.file = { - ".zshrc".source = ../dotfiles/.zshrc; ".gitconfig".source = ../dotfiles/.gitconfig; + ".zshrc".source = ../dotfiles/.zshrc; + "oh-my-posh.omp.json".source = ../dotfiles/oh-my-posh.omp.json; }; } \ No newline at end of file diff --git a/modules/shells/node20.nix b/modules/shells/node20.nix index 6ab097e..458005e 100644 --- a/modules/shells/node20.nix +++ b/modules/shells/node20.nix @@ -13,5 +13,7 @@ in pkgs.runCommand "dev-node20" { } '' mkdir -p $out/bin/ ln -s ${pkgs.zsh}/bin/zsh $out/bin/dev-node20 - wrapProgram $out/bin/dev-node20 --prefix PATH : ${pkgs.lib.makeBinPath packages} + wrapProgram $out/bin/dev-node20 \ + --prefix PATH : ${pkgs.lib.makeBinPath packages} \ + --set DEV_SHELL node20 '') diff --git a/modules/shells/node22.nix b/modules/shells/node22.nix new file mode 100644 index 0000000..ac6ebb6 --- /dev/null +++ b/modules/shells/node22.nix @@ -0,0 +1,19 @@ +{ pkgs, ... }: +(let + packages = with pkgs; [ + nodejs_22 + nodePackages.pnpm + zsh + ]; +in pkgs.runCommand "dev-node22" { + # Dependencies that should exist in the runtime environment + buildInputs = packages; + # Dependencies that should only exist in the build environment + nativeBuildInputs = [ pkgs.makeWrapper ]; +} '' + mkdir -p $out/bin/ + ln -s ${pkgs.zsh}/bin/zsh $out/bin/dev-node22 + wrapProgram $out/bin/dev-node22 \ + --prefix PATH : ${pkgs.lib.makeBinPath packages} \ + --set DEV_SHELL node22 +'') diff --git a/modules/shells/node24.nix b/modules/shells/node24.nix new file mode 100644 index 0000000..1756d11 --- /dev/null +++ b/modules/shells/node24.nix @@ -0,0 +1,19 @@ +{ pkgs, ... }: +(let + packages = with pkgs; [ + nodejs_24 + nodePackages.pnpm + zsh + ]; +in pkgs.runCommand "dev-node24" { + # Dependencies that should exist in the runtime environment + buildInputs = packages; + # Dependencies that should only exist in the build environment + nativeBuildInputs = [ pkgs.makeWrapper ]; +} '' + mkdir -p $out/bin/ + ln -s ${pkgs.zsh}/bin/zsh $out/bin/dev-node24 + wrapProgram $out/bin/dev-node24 \ + --prefix PATH : ${pkgs.lib.makeBinPath packages} \ + --set DEV_SHELL node24 +'') -- 2.51.2