diff options
Diffstat (limited to 'users/seth/programs')
| -rw-r--r-- | users/seth/programs/bash.nix | 47 | ||||
| -rw-r--r-- | users/seth/programs/default.nix | 4 | ||||
| -rw-r--r-- | users/seth/programs/fish.nix | 68 | ||||
| -rw-r--r-- | users/seth/programs/nu.nix | 45 | ||||
| -rw-r--r-- | users/seth/programs/zsh.nix | 120 |
5 files changed, 284 insertions, 0 deletions
diff --git a/users/seth/programs/bash.nix b/users/seth/programs/bash.nix new file mode 100644 index 0000000..692ec58 --- /dev/null +++ b/users/seth/programs/bash.nix @@ -0,0 +1,47 @@ +{ config, lib, ... }: +let + cfg = config.seth.programs.bash; +in +{ + options.seth.programs.bash = { + enable = lib.mkEnableOption "Bash configuration" // { + default = config.seth.enable; + defaultText = lib.literalExpression "config.seth.enable"; + }; + }; + + config = lib.mkIf cfg.enable ( + lib.mkMerge [ + { + programs.bash = { + enable = true; + + historyFile = "${config.xdg.stateHome}/bash/history"; + historyFileSize = 1000; + historySize = 100; + + shellOptions = [ + "cdspell" + "checkjobs" + "checkwinsize" + "dirspell" + "globstar" + "histappend" + "no_empty_cmd_completion" + ]; + }; + } + + # TODO: find out if i need this anymore with standalone HM + (lib.mkIf config.seth.standalone.enable { + programs.bash = { + + bashrcExtra = '' + nixfile=${config.home.homeDirectory}/.nix-profile/etc/profile.d/nix.sh + [ -e "$nixfile" ] && source "$nixfile" + ''; + }; + }) + ] + ); +} diff --git a/users/seth/programs/default.nix b/users/seth/programs/default.nix index 686d309..fc6ae12 100644 --- a/users/seth/programs/default.nix +++ b/users/seth/programs/default.nix @@ -19,20 +19,24 @@ in catppuccin.homeManagerModules.catppuccin nix-index-database.hmModules.nix-index + ./bash.nix ./chromium.nix ./firefox + ./fish.nix ./git.nix ./gpg.nix ./mangohud.nix ./moar.nix ./ncspot.nix ./neovim.nix + ./nu.nix ./ssh.nix ./starship ./vim.nix ./vscode.nix ./yazi.nix ./zellij.nix + ./zsh.nix ]; config = lib.mkIf cfg.basePrograms.enable { diff --git a/users/seth/programs/fish.nix b/users/seth/programs/fish.nix new file mode 100644 index 0000000..b1f792a --- /dev/null +++ b/users/seth/programs/fish.nix @@ -0,0 +1,68 @@ +{ + config, + lib, + pkgs, + ... +}: +let + cfg = config.seth.programs.fish; +in +{ + options.seth.programs.fish = { + enable = lib.mkEnableOption "Fish configuration"; + withPlugins = lib.mkEnableOption "Fish plugins" // { + default = true; + }; + }; + + config = lib.mkIf cfg.enable ( + lib.mkMerge [ + { + programs.fish = { + enable = true; + + interactiveShellInit = '' + ${lib.getExe pkgs.nix-your-shell} fish | source + ''; + + functions = { + last_history_item.body = "echo $history[1]"; + }; + + shellAbbrs = { + nixgc = "sudo nix-collect-garbage -d && nix-collect-garbage -d"; + "!!" = { + position = "anywhere"; + function = "last_history_item"; + }; + }; + }; + } + + # TODO: do i still need this weird sourcing? + (lib.mkIf config.seth.standalone.enable { + programs.fish = { + interactiveShellInit = '' + set -l nixfile ${config.home.homeDirectory}/.nix-profile/etc/profile.d/nix.fish + if test -e $nixfile + source $nixfile + end + ''; + }; + }) + + (lib.mkIf cfg.withPlugins { + programs.fish = { + plugins = + let + useFishPlugins = map (plugin: { + name = plugin; + inherit (pkgs.fishPlugins.${plugin}) src; + }); + in + useFishPlugins [ "autopair" ]; + }; + }) + ] + ); +} diff --git a/users/seth/programs/nu.nix b/users/seth/programs/nu.nix new file mode 100644 index 0000000..89a6803 --- /dev/null +++ b/users/seth/programs/nu.nix @@ -0,0 +1,45 @@ +{ + config, + lib, + pkgs, + ... +}: +let + cfg = config.seth.programs.nushell; + theme = "catppuccin-${config.catppuccin.flavor}"; +in +{ + options.seth.programs.nushell = { + enable = lib.mkEnableOption "Nushell configuration"; + }; + + config = lib.mkIf cfg.enable { + programs = { + nushell = { + enable = true; + + configFile.text = '' + def "nixgc" [] { + sudo nix-collect-garbage -d; nix-collect-garbage -d + } + ''; + + envFile.text = '' + use ${pkgs.nu_scripts}/share/nu_scripts/themes/nu-themes/${theme}.nu + $env.config.color_config = (${theme}) + ''; + + inherit (config.home) shellAliases; + }; + + bash.initExtra = lib.mkAfter '' + if [[ $(ps --no-header --pid=$PPID --format=comm) != "nu" && -z ''${BASH_EXECUTION_STRING} ]]; then + exec ${lib.getExe config.programs.nushell.package} + fi + ''; + + # builtin `ls` is good here! + eza.enable = lib.mkForce false; + }; + }; +} diff --git a/users/seth/programs/zsh.nix b/users/seth/programs/zsh.nix new file mode 100644 index 0000000..f4c30bd --- /dev/null +++ b/users/seth/programs/zsh.nix @@ -0,0 +1,120 @@ +{ + config, + lib, + pkgs, + ... +}: +let + cfg = config.seth.programs.zsh; +in +{ + options.seth.programs.zsh = { + enable = lib.mkEnableOption "Zsh configuration"; + withPlugins = lib.mkEnableOption "Zsh plugins" // { + default = true; + }; + }; + + config = lib.mkIf cfg.enable { + programs.zsh = lib.mkMerge [ + { + enable = 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 + + 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 + + ${lib.getExe pkgs.nix-your-shell} zsh | source /dev/stdin + + [[ ! -f ~/.config/zsh/.p10k.zsh ]] || source ~/.config/zsh/.p10k.zsh + ''; + + history = { + expireDuplicatesFirst = true; + path = "${config.xdg.stateHome}/zsh/zsh_history"; + save = 1000; + size = 100; + }; + } + + (lib.mkIf cfg.withPlugins { + plugins = [ + { + 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"; + } + ]; + + autosuggestion.enable = true; + syntaxHighlighting.enable = true; + }) + ]; + }; +} |
