95 lines
2.9 KiB
Nix
95 lines
2.9 KiB
Nix
|
{ pkgs, lib, config, ... }:
|
||
|
with lib;
|
||
|
let cfg = config.modules.zsh;
|
||
|
in {
|
||
|
options.modules.zsh = { enable = mkEnableOption "zsh"; };
|
||
|
|
||
|
config = mkIf cfg.enable {
|
||
|
home.packages = [
|
||
|
pkgs.zsh
|
||
|
];
|
||
|
|
||
|
programs.zsh = {
|
||
|
enable = true;
|
||
|
|
||
|
# directory to put config files in
|
||
|
dotDir = ".config/zsh";
|
||
|
|
||
|
enableCompletion = true;
|
||
|
enableAutosuggestions = true;
|
||
|
enableSyntaxHighlighting = true;
|
||
|
|
||
|
# .zshrc
|
||
|
initExtra = ''
|
||
|
PROMPT="%F{blue}%m %~%b "$'\n'"%(?.%F{green}%Bλ%b |.%F{red}?) %f"
|
||
|
|
||
|
export PASSWORD_STORE_DIR="$XDG_DATA_HOME/password-store";
|
||
|
export ZK_NOTEBOOK_DIR="~/stuff/notes";
|
||
|
export DIRENV_LOG_FORMAT="";
|
||
|
bindkey '^ ' autosuggest-accept
|
||
|
|
||
|
# zoxide
|
||
|
eval "$(zoxide init zsh)"
|
||
|
|
||
|
edir() { tar -cz $1 | age -p > $1.tar.gz.age && rm -rf $1 &>/dev/null && echo "$1 encrypted" }
|
||
|
ddir() { age -d $1 | tar -xz && rm -rf $1 &>/dev/null && echo "$1 decrypted" }
|
||
|
'';
|
||
|
|
||
|
# basically aliases for directories:
|
||
|
# `cd ~dots` will cd into ~/.config/nixos
|
||
|
dirHashes = {
|
||
|
dots = "$HOME/.config/nixos";
|
||
|
stuff = "$HOME/stuff";
|
||
|
media = "/run/media/$USER";
|
||
|
junk = "$HOME/stuff/other";
|
||
|
};
|
||
|
|
||
|
# Tweak settings for history
|
||
|
history = {
|
||
|
save = 1000;
|
||
|
size = 1000;
|
||
|
path = "$HOME/.cache/zsh_history";
|
||
|
};
|
||
|
|
||
|
# Set some aliases
|
||
|
shellAliases = {
|
||
|
gc = "nix-collect-garbage --delete-old";
|
||
|
refresh = "source ${config.home.homeDirectory}/.zshrc";
|
||
|
show_path = "echo $PATH | tr ':' '\n'";
|
||
|
c = "clear";
|
||
|
mkdir = "mkdir -vp";
|
||
|
rm = "rm -rifv";
|
||
|
mv = "mv -iv";
|
||
|
cp = "cp -riv";
|
||
|
cat = "bat --paging=never --style=plain";
|
||
|
ls = "exa -a --icons";
|
||
|
tree = "exa --tree --icons";
|
||
|
nd = "nix develop -c $SHELL";
|
||
|
rebuild = "doas nixos-rebuild switch --flake $NIXOS_CONFIG_DIR --fast; notify-send 'Rebuild complete\!'";
|
||
|
};
|
||
|
|
||
|
# Source all plugins, nix-style
|
||
|
plugins = [
|
||
|
{
|
||
|
name = "auto-ls";
|
||
|
src = pkgs.fetchFromGitHub {
|
||
|
owner = "notusknot";
|
||
|
repo = "auto-ls";
|
||
|
rev = "";
|
||
|
sha256 = "";
|
||
|
};
|
||
|
};
|
||
|
# {
|
||
|
# name = ""
|
||
|
# src = pkgs.fetchFromGitHub {
|
||
|
# owner = "";
|
||
|
# repo = "";
|
||
|
# rev = "";
|
||
|
# sha256 = "";
|
||
|
# }
|
||
|
# }
|
||
|
];
|
||
|
};
|
||
|
};
|
||
|
}
|