2019-12-15 07:37:46 +03:00
|
|
|
{ lib, pkgs, ... }:
|
|
|
|
let
|
|
|
|
inherit (builtins)
|
|
|
|
concatStringsSep
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
|
|
inherit (lib)
|
|
|
|
fileContents
|
|
|
|
;
|
|
|
|
|
|
|
|
in
|
|
|
|
{
|
|
|
|
users.defaultUserShell = pkgs.zsh;
|
|
|
|
|
|
|
|
environment = {
|
|
|
|
sessionVariables = let
|
|
|
|
fd = "${pkgs.fd}/bin/fd -H";
|
|
|
|
in
|
2019-12-15 11:08:22 +03:00
|
|
|
{
|
|
|
|
BAT_PAGER = "less";
|
|
|
|
SKIM_ALT_C_COMMAND =
|
|
|
|
"while read line; do "
|
|
|
|
+ "line=\"'\${(Q)line}'\"; [[ -d \"'$line'\" ]] && echo \"'$line'\"; "
|
|
|
|
+ "done < $HOME/.cache/zsh-cdr/recent-dirs";
|
|
|
|
SKIM_DEFAULT_COMMAND = fd;
|
|
|
|
SKIM_CTRL_T_COMMAND = fd;
|
|
|
|
};
|
2019-12-15 07:37:46 +03:00
|
|
|
|
|
|
|
shellAliases = {
|
|
|
|
cat = "${pkgs.bat}/bin/bat";
|
|
|
|
|
|
|
|
df = "df -h";
|
|
|
|
du = "du -h";
|
|
|
|
|
|
|
|
ls = "${pkgs.exa}/bin/exa";
|
2019-12-18 04:10:18 +03:00
|
|
|
l = "ls -lhg --git";
|
2019-12-15 07:37:46 +03:00
|
|
|
la = "l -a";
|
|
|
|
|
2019-12-18 04:10:18 +03:00
|
|
|
ps = "${pkgs.procs}/bin/procs";
|
|
|
|
|
2019-12-15 07:37:46 +03:00
|
|
|
rz = "exec zsh";
|
|
|
|
};
|
|
|
|
|
|
|
|
systemPackages = with pkgs; [
|
2019-12-18 04:10:18 +03:00
|
|
|
bat
|
2019-12-15 10:27:41 +03:00
|
|
|
bzip2
|
2019-12-15 07:37:46 +03:00
|
|
|
direnv
|
2019-12-18 04:10:18 +03:00
|
|
|
exa
|
2019-12-15 07:37:46 +03:00
|
|
|
gitAndTools.hub
|
2019-12-15 10:27:41 +03:00
|
|
|
gzip
|
|
|
|
lrzip
|
|
|
|
p7zip
|
2019-12-18 04:10:18 +03:00
|
|
|
procs
|
2019-12-15 07:37:46 +03:00
|
|
|
skim
|
2019-12-15 10:27:41 +03:00
|
|
|
unrar
|
|
|
|
unzip
|
|
|
|
xz
|
2019-12-18 04:10:18 +03:00
|
|
|
zsh-completions
|
2019-12-15 07:37:46 +03:00
|
|
|
];
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
nixpkgs.overlays = let
|
|
|
|
purs = self: super:
|
2019-12-15 11:08:22 +03:00
|
|
|
{ purs = super.callPackage ../../../pkgs/shells/zsh/purs {}; };
|
2019-12-15 07:37:46 +03:00
|
|
|
in
|
2019-12-15 11:08:22 +03:00
|
|
|
[ purs ];
|
2019-12-15 07:37:46 +03:00
|
|
|
|
|
|
|
|
|
|
|
programs.zsh = {
|
|
|
|
enable = true;
|
|
|
|
|
|
|
|
promptInit = ''
|
|
|
|
source ${pkgs.purs}/share/zsh/plugins/purs/purs.zsh
|
|
|
|
'';
|
|
|
|
|
|
|
|
interactiveShellInit = let
|
|
|
|
zshrc = fileContents ./zshrc;
|
|
|
|
|
2019-12-16 06:54:11 +03:00
|
|
|
sources = with pkgs; [
|
2019-12-17 01:36:20 +03:00
|
|
|
./cdr.zsh
|
2019-12-15 07:37:46 +03:00
|
|
|
"${skim}/share/skim/completion.zsh"
|
|
|
|
"${oh-my-zsh}/share/oh-my-zsh/plugins/sudo/sudo.plugin.zsh"
|
|
|
|
"${oh-my-zsh}/share/oh-my-zsh/plugins/extract/extract.plugin.zsh"
|
2019-12-16 08:32:40 +03:00
|
|
|
"${zsh-you-should-use}/share/zsh/plugins/you-should-use/you-should-use.plugin.zsh"
|
2019-12-15 07:37:46 +03:00
|
|
|
"${zsh-syntax-highlighting}/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"
|
|
|
|
"${zsh-history-substring-search}/share/zsh-history-substring-search/zsh-history-substring-search.zsh"
|
|
|
|
];
|
|
|
|
|
|
|
|
source = map
|
2019-12-16 06:54:11 +03:00
|
|
|
(source: "source ${source}")
|
|
|
|
sources;
|
|
|
|
|
|
|
|
functions = pkgs.stdenv.mkDerivation {
|
|
|
|
name = "zsh-functions";
|
|
|
|
src = ./functions;
|
|
|
|
|
|
|
|
ripgrep = "${pkgs.ripgrep}";
|
|
|
|
man = "${pkgs.man}";
|
2019-12-18 10:00:44 +03:00
|
|
|
exa = "${pkgs.exa}";
|
2019-12-16 06:54:11 +03:00
|
|
|
|
|
|
|
installPhase = let
|
|
|
|
basename = "\${file##*/}";
|
|
|
|
in
|
|
|
|
''
|
|
|
|
mkdir $out
|
|
|
|
|
|
|
|
for file in $src/*; do
|
|
|
|
substituteAll $file $out/${basename}
|
|
|
|
chmod 755 $out/${basename}
|
|
|
|
done
|
|
|
|
'';
|
|
|
|
};
|
2019-12-15 07:37:46 +03:00
|
|
|
|
|
|
|
plugins = concatStringsSep "\n"
|
2019-12-15 11:08:22 +03:00
|
|
|
(
|
|
|
|
[
|
|
|
|
"${pkgs.any-nix-shell}/bin/any-nix-shell zsh --info-right | source /dev/stdin"
|
|
|
|
] ++ source
|
|
|
|
);
|
2019-12-15 07:37:46 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
in
|
|
|
|
''
|
|
|
|
${plugins}
|
|
|
|
|
2019-12-16 06:54:11 +03:00
|
|
|
fpath+=( ${functions} )
|
|
|
|
autoload -Uz ${functions}/*(:t)
|
|
|
|
|
2019-12-15 07:37:46 +03:00
|
|
|
${zshrc}
|
|
|
|
|
2019-12-16 06:54:11 +03:00
|
|
|
eval "$(${pkgs.direnv}/bin/direnv hook zsh)"
|
|
|
|
eval $(${pkgs.gitAndTools.hub}/bin/hub alias -s)
|
2019-12-15 07:37:46 +03:00
|
|
|
source ${pkgs.skim}/share/skim/key-bindings.zsh
|
2019-12-16 08:46:11 +03:00
|
|
|
|
|
|
|
# needs to remain at bottom so as not to be overwritten
|
|
|
|
bindkey jj vi-cmd-mode
|
2019-12-15 07:37:46 +03:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
}
|