From 0630db91fba0417d1d7261647e8aefc97f712aa1 Mon Sep 17 00:00:00 2001 From: voidarc Date: Wed, 1 Jul 2026 21:04:37 +0100 Subject: [PATCH] fixed zsh HOLY SHIT THIS IS THE COOLEST THING EVER --- flake.nix | 1 - modules/dots/zsh/default.nix | 9 --- modules/features/zsh/config.toml | 100 +++++++++++++++++++++++++++++++ modules/features/zsh/default.nix | 36 +++++++++++ modules/pacakges/zsh/default.nix | 11 ---- 5 files changed, 136 insertions(+), 21 deletions(-) delete mode 100644 modules/dots/zsh/default.nix create mode 100644 modules/features/zsh/config.toml create mode 100644 modules/features/zsh/default.nix delete mode 100644 modules/pacakges/zsh/default.nix diff --git a/flake.nix b/flake.nix index a159a52..22e6d82 100644 --- a/flake.nix +++ b/flake.nix @@ -10,6 +10,5 @@ wrappers.url = "github:BirdeeHub/nix-wrapper-modules"; }; - outputs = inputs: inputs.flake-parts.lib.mkFlake {inherit inputs;} (inputs.import-tree ./modules); } diff --git a/modules/dots/zsh/default.nix b/modules/dots/zsh/default.nix deleted file mode 100644 index f04fefc..0000000 --- a/modules/dots/zsh/default.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ ... }: -{ - flake.dots.zshrc = pkgs: '' - source ${pkgs.carapace}/share/carapace-bin/bash-preexec.sh - export PATH="${pkgs.carapace}/bin:$PATH" - - alias ls="${pkgs.eza}/bin/eza" - ''; -} diff --git a/modules/features/zsh/config.toml b/modules/features/zsh/config.toml new file mode 100644 index 0000000..f8d15ed --- /dev/null +++ b/modules/features/zsh/config.toml @@ -0,0 +1,100 @@ +console_title_template = '{{ .Shell }} in {{ .Folder }}' +version = 3 +final_space = true + +[secondary_prompt] + template = '❯❯ ' + foreground = 'magenta' + background = 'transparent' + +[transient_prompt] + template = '❯ ' + background = 'transparent' + foreground_templates = ['{{if gt .Code 0}}red{{end}}', '{{if eq .Code 0}}magenta{{end}}'] + +[[blocks]] + type = 'prompt' + alignment = 'left' + newline = true + +[[blocks.segments]] +type = 'text' +style = 'plain' +template = ''' +{{- if .Env.DEVSHELL_NAME -}} + {{- $parts := split "|" .Env.DEVSHELL_NAME -}} + {{- range $part := $parts -}} + {{- if $part -}} + {{- $sub := split "/" $part -}} + {{- if eq (len $sub) 2 -}} + <{{ index $sub "_1" }}>{{ index $sub "_0" }} <#7f849c>| + {{- end -}} + {{- end -}} + {{- end -}} +{{- end -}} +''' + + [[blocks.segments]] # Python venv + type = 'text' + style = 'plain' + template = '{{ if .Env.VIRTUAL_ENV }}🐍 venv <#7f849c>| {{ end }}' + + [[blocks.segments]] # Nix shell indicator + type = 'text' + style = 'plain' + template = '{{ if and .Env.IN_NIX_SHELL (not .Env.DEVSHELL_NAME) }} nsh <#7f849c>| {{ end }}' + + [[blocks.segments]] + template = '{{ .Path }}' + foreground = 'blue' + background = 'transparent' + type = 'path' + style = 'plain' + + [blocks.segments.properties] + cache_duration = 'none' + style = 'full' + + [[blocks.segments]] + template = ' {{ .HEAD }}{{ if or (.Working.Changed) (.Staging.Changed) }} *{{ end }} {{ if gt .Behind 0 }}󰁅{{ end }}{{ if gt .Ahead 0 }}{{ end }}' + foreground = 'green' + background = 'transparent' + type = 'git' + style = 'plain' + + [blocks.segments.properties] + branch_icon = '' + cache_duration = 'none' + commit_icon = '@' + fetch_status = true + +[[blocks]] + type = 'rprompt' + overflow = 'hidden' + + [[blocks.segments]] + template = '{{ .FormattedMs }}' + foreground = 'yellow' + background = 'transparent' + type = 'executiontime' + style = 'plain' + + [blocks.segments.properties] + cache_duration = 'none' + threshold = 5000 + +[[blocks]] + type = 'prompt' + alignment = 'left' + newline = true + + [[blocks.segments]] + template = '❯' + background = 'transparent' + type = 'text' + style = 'plain' + foreground_templates = ['{{if gt .Code 0}}red{{end}}', '{{if eq .Code 0}}magenta{{end}}'] + + [blocks.segments.properties] + cache_duration = 'none' + diff --git a/modules/features/zsh/default.nix b/modules/features/zsh/default.nix new file mode 100644 index 0000000..b55375d --- /dev/null +++ b/modules/features/zsh/default.nix @@ -0,0 +1,36 @@ +{ + self, + inputs, + ... +}: { + flake.nixosModules.zsh = { + pkgs, + lib, + ... + }: { + programs.zsh = { + enable = true; + package = self.packages.${pkgs.stdenv.hostPlatform.system}.myZsh; + }; + }; + perSystem = { + pkgs, + lib, + self', + ... + }: { + packages = { + myZsh = inputs.wrappers.wrappers.zsh.wrap { + inherit pkgs; + zshrc.content = '' + eval "$(${self.packages.${pkgs.host.stdenv.hostPlatform.system}.ohMyPosh}/bin/oh-my-posh init zsh)" + alias ls=${pkgs.lsd}/bin/lsd + ''; + }; + ohMyPosh = inputs.wrappers.wrappers.oh-my-posh.wrap { + inherit pkgs; + configFile = ./config.toml; + }; + }; + }; +} diff --git a/modules/pacakges/zsh/default.nix b/modules/pacakges/zsh/default.nix deleted file mode 100644 index 486ace5..0000000 --- a/modules/pacakges/zsh/default.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ - self, - inputs, - ... -}: { - perSystem = {pkgs, ...}: { - packages.myZsh = inputs.wrappers.wrappers.zsh.wrap { - zshrc.content = (self.dots.zshrc pkgs); - }; - }; -}