user/modules/zsh.nix (view raw)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | { config, pkgs, ... }:
let
inherit (pkgs) stdenv;
lsOptions = if stdenv.isDarwin then "-p" else "-v --group-directories-first";
lsIsoDate = if stdenv.isDarwin then "" else "--time-style=long-iso";
in
{
home.file = {
".rm_recycle_home".text = ""; # use trash automatically in home directory
};
home.packages = with pkgs; [
fzf
ghq
] ++ (if stdenv.isDarwin
then []
else [
pkgs.git
]);
xdg.configFile.zsh = {
recursive = true;
source = ../zsh/.config/zsh;
};
home.file.".zplugin/bin" = {
recursive = true;
source = pkgs.fetchFromGitHub {
owner = "zdharma";
repo = "zplugin";
rev = "028b1e1d6d3eae204b499c7f815f4eeeb5051517";
sha256 = "1ynh323905iia3gwi9qghbywp94x306nna1yqk37frj5g7kg90fa";
};
onChange = "${pkgs.zsh}/bin/zsh -c 'zcompile $HOME/.zplugin/bin/zplugin.zsh'";
};
programs.zsh = {
enable = true;
enableAutosuggestions = true;
enableCompletion = true;
defaultKeymap = "emacs";
dotDir = ".config/zsh";
history = {
expireDuplicatesFirst = true;
extended = true;
path = ".cache/zsh/history";
save = 20000;
size = 10000;
};
localVariables = {
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE = "fg=7";
};
shellAliases = {
l = "ls ${lsOptions} -Bp";
l1="ls -1";
ls="ls ${lsOptions} -hF";
la="ls ${lsOptions} -hA";
ll="ls ${lsOptions} ${lsIsoDate} -hl";
lal="ll -A";
lla="lal";
llr="ll -t";
https = "http --default-scheme https";
kns = "kubens";
kx = "kubectx";
ava = "pnpx ava";
avt = "pnpx ava --tap";
avat = "pnpx ava --tap";
pino = "pino-pretty";
mocha = "pnpx mocha";
prettier = "pnpx prettier";
standard = "pnpx standard";
tsc = "pnpx tsc";
tslint = "pnpx tslint";
tsnode = "pnpx ts-node";
wprop = "xprop | egrep '^WM_(CLASS|NAME|WINDOW_ROLE|TYPE)'";
watch = "watch "; # enable watch with aliases
};
# move to envExtra after 19.09
initExtra = ''
case $OSTYPE in
darwin*)
os=darwin
;;
linux-gnu)
os=linux
;;
freebsd*)
os=freebsd
;;
*)
os=unknown
;;
esac
case $MACHTYPE in
*64)
arch=amd64
;;
*)
arch=386
;;
esac
if [[ ''${path[(I)$HOME/.local/bin ]} ]]
then
path+=($HOME/.local/bin)
fi
if [[ ''${path[(I)$HOME/go/bin ]} ]]
then
path+=($HOME/go/bin)
fi
if [[ $HOST =~ satoshi ]]
then
EMAIL=alan@satoshipay.io
else
EMAIL=alan@alanpearce.eu
fi
typeset -T GHQ_ROOT ghq_root
export GHQ_ROOT="$HOME/projects:$HOME/go/src:$HOME/quicklisp/local-projects"
'' + builtins.readFile ../zsh/.config/zsh/.zshrc;
};
}
|