diff options
Diffstat (limited to 'parts/users/seth/shell')
| -rw-r--r-- | parts/users/seth/shell/bash.nix | 21 | ||||
| -rw-r--r-- | parts/users/seth/shell/default.nix | 79 | ||||
| -rw-r--r-- | parts/users/seth/shell/fish.nix | 52 | ||||
| -rw-r--r-- | parts/users/seth/shell/starship.toml | 220 | ||||
| -rw-r--r-- | parts/users/seth/shell/zsh.nix | 114 |
5 files changed, 486 insertions, 0 deletions
diff --git a/parts/users/seth/shell/bash.nix b/parts/users/seth/shell/bash.nix new file mode 100644 index 0000000..f9a1afa --- /dev/null +++ b/parts/users/seth/shell/bash.nix @@ -0,0 +1,21 @@ +{config, ...}: { + programs.bash = { + enable = true; + bashrcExtra = '' + nixfile=${config.home.homeDirectory}/.nix-profile/etc/profile.d/nix.sh + [ -e "$nixfile" ] && source "$nixfile" + ''; + historyFile = "${config.xdg.stateHome}/bash/history"; + historyFileSize = 1000; + historySize = 100; + shellOptions = [ + "cdspell" + "checkjobs" + "checkwinsize" + "dirspell" + "globstar" + "histappend" + "no_empty_cmd_completion" + ]; + }; +} diff --git a/parts/users/seth/shell/default.nix b/parts/users/seth/shell/default.nix new file mode 100644 index 0000000..5f7e24c --- /dev/null +++ b/parts/users/seth/shell/default.nix @@ -0,0 +1,79 @@ +{ + config, + pkgs, + ... +}: let + inherit (builtins) fromTOML readFile; + inherit (pkgs) fetchFromGitHub; +in { + imports = [ + ./bash.nix + ./fish.nix + ]; + + programs = { + bat = { + enable = true; + config = { + theme = "catppuccin"; + }; + themes = { + catppuccin = readFile (fetchFromGitHub { + owner = "catppuccin"; + repo = "bat"; + rev = "ba4d16880d63e656acced2b7d4e034e4a93f74b1"; + sha256 = "sha256-6WVKQErGdaqb++oaXnY3i6/GuH2FhTgK0v4TN4Y0Wbw="; + } + + "/Catppuccin-mocha.tmTheme"); + }; + }; + + eza = { + enable = true; + enableAliases = true; + icons = true; + }; + + starship = { + enable = true; + enableBashIntegration = false; + enableZshIntegration = false; + settings = + { + format = "$all"; + palette = "catppuccin_mocha"; + command_timeout = 50; + } + // fromTOML (readFile ./starship.toml) + // fromTOML (readFile + (fetchFromGitHub + { + owner = "catppuccin"; + repo = "starship"; + rev = "3e3e54410c3189053f4da7a7043261361a1ed1bc"; + sha256 = "sha256-soEBVlq3ULeiZFAdQYMRFuswIIhI9bclIU8WXjxd7oY="; + } + + "/palettes/mocha.toml")); + }; + }; + + home = { + sessionVariables = let + inherit (config.xdg) configHome dataHome stateHome; + in { + EDITOR = "nvim"; + VISUAL = "$EDITOR"; + GPG_TTY = "$(tty)"; + CARGO_HOME = "${dataHome}/cargo"; + RUSTUP_HOME = "${dataHome}/rustup"; + LESSHISTFILE = "${stateHome}/less/history"; + NPM_CONFIG_USERCONFIG = "${configHome}/npm/npmrc"; + }; + + shellAliases = { + diff = "diff --color=auto"; + g = "git"; + gs = "g status"; + }; + }; +} diff --git a/parts/users/seth/shell/fish.nix b/parts/users/seth/shell/fish.nix new file mode 100644 index 0000000..7488b40 --- /dev/null +++ b/parts/users/seth/shell/fish.nix @@ -0,0 +1,52 @@ +{ + config, + pkgs, + ... +}: { + xdg.configFile."fish/themes" = { + recursive = true; + source = + pkgs.fetchFromGitHub + { + owner = "catppuccin"; + repo = "fish"; + rev = "b90966686068b5ebc9f80e5b90fdf8c02ee7a0ba"; + sha256 = "sha256-wQlYQyqklU/79K2OXRZXg5LvuIugK7vhHgpahpLFaOw="; + } + + "/themes"; + }; + + programs.fish = { + enable = true; + + interactiveShellInit = '' + set -l nixfile ${config.home.homeDirectory}/.nix-profile/etc/profile.d/nix.fish + if test -e $nixfile + source $nixfile + end + + fish_config theme choose "Catppuccin Mocha" + nix-your-shell fish | source + + abbr -a !! --position anywhere --function last_history_item + ''; + + functions = { + last_history_item.body = "echo $history[1]"; + }; + + shellAbbrs = { + nixgc = "sudo nix-collect-garbage -d && nix-collect-garbage -d"; + }; + + plugins = let + mkFishPlugins = builtins.map (plugin: { + name = plugin; + inherit (pkgs.fishPlugins.${plugin}) src; + }); + in + mkFishPlugins [ + "autopair" + ]; + }; +} diff --git a/parts/users/seth/shell/starship.toml b/parts/users/seth/shell/starship.toml new file mode 100644 index 0000000..94a2922 --- /dev/null +++ b/parts/users/seth/shell/starship.toml @@ -0,0 +1,220 @@ +[aws] +symbol = " " + +[bun] +format = "via [$symbol]($style)" + +[buf] +format = "via [$symbol]($style)" +symbol = " " + +[c] +symbol = " " + +[cmake] +format = "via [$symbol]($style)" + +[cobol] +format = "via [$symbol]($style)" + +[conda] +symbol = " " + +[crystal] +format = "via [$symbol]($style)" + +[daml] +format = "via [$symbol]($style)" + +[dart] +format = "via [$symbol]($style)" +symbol = " " + +[directory] +read_only = " " + +[deno] +format = "via [$symbol]($style)" + +[docker_context] +symbol = " " + +[dotnet] +format = "[$symbol(🎯 $tfm )]($style)" + +[elixir] +format = 'via [$symbol]($style)' +symbol = " " + +[elm] +format = 'via [$symbol]($style)' +symbol = " " + +[erlang] +format = 'via [$symbol]($style)' + +[fennel] +format = 'via [$symbol]($style)' + +[fossil_branch] +symbol = " " + +[git_branch] +symbol = " " + +[golang] +format = 'via [$symbol]($style)' +symbol = " " + +[gradle] +format = 'via [$symbol]($style)' + +[guix_shell] +symbol = " " + +[haskell] +symbol = " " + +[haxe] +format = 'via [$symbol]($style)' +symbol = "⌘ " + +[helm] +format = 'via [$symbol]($style)' + +[hg_branch] +symbol = " " + +[java] +symbol = " " + +[julia] +format = 'via [$symbol]($style)' +symbol = " " + +[kotlin] +format = 'via [$symbol]($style)' + +[lua] +format = 'via [$symbol]($style)' +symbol = " " + +[memory_usage] +symbol = " " + +[meson] +format = 'via [$symbol]($style)' +symbol = "喝 " + +[nim] +format = 'via [$symbol]($style)' +symbol = " " + +[nix_shell] +symbol = " " + +[nodejs] +format = 'via [$symbol]($style)' +symbol = " " + +[ocaml] +format = 'via [$symbol(\($switch_indicator$switch_name\) )]($style)' + +[opa] +format = 'via [$symbol]($style)' + +[os.symbols] +Alpine = " " +Amazon = " " +Android = " " +Arch = " " +CentOS = " " +Debian = " " +DragonFly = " " +Emscripten = " " +EndeavourOS = " " +Fedora = " " +FreeBSD = " " +Garuda = " " +Gentoo = " " +HardenedBSD = "ﲊ " +Illumos = " " +Linux = " " +Macos = " " +Manjaro = " " +Mariner = " " +MidnightBSD = " " +Mint = " " +NetBSD = " " +NixOS = " " +OpenBSD = " " +openSUSE = " " +OracleLinux = " " +Pop = " " +Raspbian = " " +Redhat = " " +RedHatEnterprise = " " +Redox = " " +Solus = "ﴱ " +SUSE = " " +Ubuntu = " " +Unknown = " " +Windows = " " + +[package] +symbol = " " + +[perl] +format = 'via [$symbol]($style)' + +[php] +format = 'via [$symbol]($style)' + +[pijul_channel] +symbol = "🪺 " + +[pulumi] +format = 'via [$symbol$stack]($style)' + +[purescript] +format = 'via [$symbol]($style)' + +[python] +format = 'via [$symbol]($style)' +symbol = " " + +[raku] +format = 'via [$symbol]($style)' + +[red] +format = 'via [$symbol]($style)' + +[rlang] +format = 'via [$symbol]($style)' +symbol = "ﳒ " + +[ruby] +format = 'via [$symbol]($style)' +symbol = " " + +[rust] +format = 'via [$symbol]($style)' +symbol = " " + +[scala] +symbol = " " + +[spack] +symbol = "🅢 " + +[swift] +format = 'via [$symbol]($style)' + +[vagrant] +format = 'via [$symbol]($style)' + +[vlang] +format = 'via [$symbol]($style)' + +[zig] +format = 'via [$symbol]($style)' diff --git a/parts/users/seth/shell/zsh.nix b/parts/users/seth/shell/zsh.nix new file mode 100644 index 0000000..23d5813 --- /dev/null +++ b/parts/users/seth/shell/zsh.nix @@ -0,0 +1,114 @@ +{ + config, + pkgs, + ... +}: { + programs.zsh = { + enable = true; + enableAutosuggestions = true; + + completionInit = '' + autoload -Uz bashcompinit compinit + local zdump="${config.xdg.cacheHome}/zsh/zdump" + bashcompinit + compinit -d "$zdump" + if [[ ! "$zdump.zwc" -nt "$zdump" ]] + then + zcompile "$zdump" + fi + unset zdump + ''; + + defaultKeymap = "emacs"; + dotDir = ".config/zsh"; + + initExtra = '' + if [[ -r "$XDG_CACHE_HOME/p10k-instant-prompt-*.zsh" ]]; then + source "$XDG_CACHE_HOME/p10k-instant-prompt-*.zsh" + fi + autoload -Uz promptinit colors + promptinit + colors + + nix-your-shell zsh | source /dev/stdin + + zmodload zsh/zutil + zmodload zsh/complist + zstyle ":completion::*" group-name "" + zstyle ":completion:*" menu "select" + zstyle ":completion:*" squeeze-slashes "true" + zstyle ":completion::*" use-cache "true" + zstyle ":completion::*" cache-path "$zdump" + + unsetopt beep + unsetopt hist_beep + unsetopt ignore_braces + unsetopt list_beep + setopt always_to_end + setopt prompt_subst + setopt share_history + + # clear backbuffer with ctrl-l + function clear-screen-and-scrollback() { + echoti civis >"$TTY" + printf '%b' '\e[H\e[2J' >"$TTY" + zle .reset-prompt + zle -R + printf '%b' '\e[3J' >"$TTY" + echoti cnorm >"$TTY" + } + + zle -N clear-screen-and-scrollback + bindkey '^L' clear-screen-and-scrollback + + [[ ! -f ~/.config/zsh/.p10k.zsh ]] || source ~/.config/zsh/.p10k.zsh + ''; + + history = { + expireDuplicatesFirst = true; + path = "${config.xdg.stateHome}/zsh/zsh_history"; + save = 1000; + size = 100; + }; + + plugins = [ + { + name = "cattppuccin-zsh-syntax-highlighting"; + src = pkgs.fetchFromGitHub { + owner = "catppuccin"; + repo = "zsh-syntax-highlighting"; + rev = "06d519c20798f0ebe275fc3a8101841faaeee8ea"; + sha256 = "sha256-Q7KmwUd9fblprL55W0Sf4g7lRcemnhjh4/v+TacJSfo="; + }; + + file = "themes/catppuccin_mocha-zsh-syntax-highlighting.zsh"; + } + + { + name = "nix-zsh-completions"; + src = pkgs.nix-zsh-completions; + file = "share/zsh/plugins/nix/nix-zsh-completions.plugin.zsh"; + } + + { + name = "powerlevel10k"; + src = pkgs.zsh-powerlevel10k; + file = "share/zsh-powerlevel10k/powerlevel10k.zsh-theme"; + } + + { + name = "zsh-autopair"; + src = pkgs.zsh-autopair; + file = "share/zsh/zsh-autopair/autopair.zsh"; + } + + { + name = "zsh-completions"; + src = pkgs.zsh-completions; + file = "share/zsh-completions/zsh-completions.plugin.zsh"; + } + ]; + + enableSyntaxHighlighting = true; + }; +} |
