summaryrefslogtreecommitdiff
path: root/users/seth/shell
diff options
context:
space:
mode:
Diffstat (limited to 'users/seth/shell')
-rw-r--r--users/seth/shell/bash.nix21
-rw-r--r--users/seth/shell/default.nix26
-rw-r--r--users/seth/shell/fish.nix39
-rw-r--r--users/seth/shell/zsh.nix114
4 files changed, 200 insertions, 0 deletions
diff --git a/users/seth/shell/bash.nix b/users/seth/shell/bash.nix
new file mode 100644
index 0000000..f9a1afa
--- /dev/null
+++ b/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/users/seth/shell/default.nix b/users/seth/shell/default.nix
new file mode 100644
index 0000000..6ca9e3e
--- /dev/null
+++ b/users/seth/shell/default.nix
@@ -0,0 +1,26 @@
+{config, ...}: {
+ imports = [
+ ./bash.nix
+ ./fish.nix
+ ];
+
+ 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/users/seth/shell/fish.nix b/users/seth/shell/fish.nix
new file mode 100644
index 0000000..fc241d0
--- /dev/null
+++ b/users/seth/shell/fish.nix
@@ -0,0 +1,39 @@
+{
+ config,
+ pkgs,
+ ...
+}: {
+ programs.fish = {
+ enable = true;
+ catppuccin.enable = true;
+
+ interactiveShellInit = ''
+ set -l nixfile ${config.home.homeDirectory}/.nix-profile/etc/profile.d/nix.fish
+ if test -e $nixfile
+ source $nixfile
+ end
+
+ 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/users/seth/shell/zsh.nix b/users/seth/shell/zsh.nix
new file mode 100644
index 0000000..23d5813
--- /dev/null
+++ b/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;
+ };
+}