# zsh as CachyOS set it up (cachyos-zsh-config: oh-my-zsh, Powerlevel10k and the # fish-like plugins), plus git, gh and ssh. { config, lib, pkgs, ... }: { programs.zsh = { enable = true; # Same history file and sizes as before (oh-my-zsh's defaults), so your # history carries over. history = { path = "${config.home.homeDirectory}/.zsh_history"; size = 50000; save = 10000; ignoreSpace = true; ignoreDups = true; }; oh-my-zsh = { enable = true; plugins = [ "git" "fzf" "extract" ]; extraConfig = '' DISABLE_MAGIC_FUNCTIONS="true" ENABLE_CORRECTION="true" COMPLETION_WAITING_DOTS="true" ''; }; syntaxHighlighting.enable = true; autosuggestion.enable = true; historySubstringSearch.enable = true; plugins = [ { name = "powerlevel10k"; src = pkgs.zsh-powerlevel10k; file = "share/zsh-powerlevel10k/powerlevel10k.zsh-theme"; } ]; shellAliases = { make = "make -j$(nproc)"; ninja = "ninja -j$(nproc)"; n = "ninja"; c = "clear"; please = "sudo"; tb = "nc termbin.com 9999"; jctl = "journalctl -p 3 -xb"; # The pacman ones, for NixOS. update = "nix flake update --flake ${config.dot.repoPath} && sudo nixos-rebuild switch --flake ${config.dot.repoPath}"; rebuild = "sudo nixos-rebuild switch --flake ${config.dot.repoPath}"; cleanup = "sudo nix-collect-garbage --delete-older-than 14d"; }; initContent = lib.mkMerge [ # Powerlevel10k instant prompt. Must stay at the very top: anything that # may ask for input goes above it, everything else below. (lib.mkOrder 500 '' if [[ -r "''${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-''${(%):-%n}.zsh" ]]; then source "''${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-''${(%):-%n}.zsh" fi '') '' export HISTCONTROL=ignoreboth export HISTORY_IGNORE="(\&|[bf]g|c|clear|history|exit|q|pwd|* --help)" # Bold green headings in man pages. export LESS_TERMCAP_md="$(tput bold 2> /dev/null; tput setaf 2 2> /dev/null)" export LESS_TERMCAP_me="$(tput sgr0 2> /dev/null)" [[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh POWERLEVEL9K_DISABLE_CONFIGURATION_WIZARD=true '' ]; }; programs.fzf.enable = true; # "command not found" suggests the package to install, like pkgfile did. programs.nix-index.enable = true; programs.nix-index.enableZshIntegration = true; programs.bash.enable = true; programs.git = { enable = true; settings.user = { name = "Gustaf Granström"; email = "gustaf@granstrm.com"; }; }; # Also makes git use gh for GitHub credentials, as in your old .gitconfig. programs.gh = { enable = true; gitCredentialHelper.enable = true; }; # ~/.ssh/config. Your keys, known_hosts and authorized_keys stay where they are # in ~/.ssh and are not part of this repo. programs.ssh = { enable = true; enableDefaultConfig = false; settings = { granstrm = { HostName = "granstrm.com"; User = "root"; IdentityFile = "~/.ssh/id_ed25519"; }; # Media center laptop, behind the Google Wifi (10.0.0.100), which # forwards port 2222 to the laptop's SSH. tv = { HostName = "10.0.0.100"; Port = 2222; User = "tv"; IdentityFile = "~/.ssh/id_ed25519"; }; }; }; }