106 lines
3.0 KiB
Nix
106 lines
3.0 KiB
Nix
{ config, lib, pkgs, ... }:
|
|
|
|
let
|
|
cfg = config.ptw.programs.zsh;
|
|
in {
|
|
options.ptw.programs.zsh = {
|
|
enable = lib.mkEnableOption "Enable and configure zsh using HomeManager";
|
|
};
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
environment = {
|
|
systemPackages = [ pkgs.zsh ];
|
|
|
|
shells = [ pkgs.zsh ];
|
|
pathsToLink = [ "/share/zsh" ];
|
|
};
|
|
|
|
# Otherwise the user won't appear on the GDM login screen
|
|
programs.zsh.enable = true;
|
|
|
|
home-manager.users."${config.ptw.system.singleUser}".programs.zsh = {
|
|
enable = true;
|
|
history.ignoreSpace = true;
|
|
shellAliases = {
|
|
ls = "ls --color=always";
|
|
".." = "cd ..";
|
|
"..." = "cd ../../";
|
|
dev = "cd $HOME/Development";
|
|
home = "cd $HOME";
|
|
reload = "$SHELL -l";
|
|
gs = "git status";
|
|
gd = "git diff";
|
|
gds = "git diff --staged";
|
|
c = "clear";
|
|
suspend = "systemctl suspend";
|
|
|
|
waifu2x = "flatpak run com.github.nihui.waifu2x-ncnn-vulkan";
|
|
};
|
|
initExtra = ''
|
|
bindkey "^[[1;5C" forward-word
|
|
bindkey "^[[1;5D" backward-word
|
|
bindkey "\e[3~" delete-char
|
|
'';
|
|
history.share = true;
|
|
# TODO: Maybe move this somewhere else
|
|
initExtraFirst = ''
|
|
wcurl() {
|
|
[[ -z "$1" ]] && echo "Error: No URL specified" && exit 1
|
|
|
|
local filename="$(basename $1)"
|
|
curl -fLo "$filename" "$1"
|
|
}
|
|
'';
|
|
plugins = [
|
|
{
|
|
name = "pure.zsh";
|
|
file = "pure.zsh";
|
|
src = pkgs.fetchFromGitHub {
|
|
owner = "sindresorhus";
|
|
repo = "pure";
|
|
rev = "v1.17.0";
|
|
sha256 = "0qfs7rvpyd8jb7x4ziqrkh0b6g9ldds8sn6qbqgrir80vdk90gpa";
|
|
};
|
|
}
|
|
{
|
|
name = "zsh-history-substring-search";
|
|
src = pkgs.fetchFromGitHub {
|
|
owner = "zsh-users";
|
|
repo = "zsh-history-substring-search";
|
|
rev = "0f80b8eb3368b46e5e573c1d91ae69eb095db3fb";
|
|
sha256 = "0y8va5kc2ram38hbk2cibkk64ffrabfv1sh4xm7pjspsba9n5p1y";
|
|
};
|
|
}
|
|
{
|
|
name = "completion";
|
|
file = "init.zsh";
|
|
src = pkgs.fetchFromGitHub {
|
|
owner = "zimfw";
|
|
repo = "completion";
|
|
rev = "db079f405397a9dc9af93883e47d8adff817e3b1";
|
|
sha256 = "1vakjj8l10discmzrzjq6nd0bg0jf4chxhwpiq7ldkirzy7lmm9c";
|
|
};
|
|
}
|
|
{
|
|
name = "zsh-completions";
|
|
src = pkgs.fetchFromGitHub {
|
|
owner = "zsh-users";
|
|
repo = "zsh-completions";
|
|
rev = "d4511c23659381b56dec8be8c8553b7ff3dc5fd8";
|
|
sha256 = "1y8wkmhgkkyfz91y1f8crh6cg912n87gmcchc8xhnwji11n1mqrq";
|
|
};
|
|
}
|
|
{
|
|
name = "zsh-syntax-highlighting";
|
|
src = pkgs.fetchFromGitHub {
|
|
owner = "zsh-users";
|
|
repo = "zsh-syntax-highlighting";
|
|
rev = "6e0e950154a4c6983d9e077ed052298ad9126144";
|
|
sha256 = "09bkg1a7qs6kvnq17jnw5cbcjhz9sk259mv0d5mklqaifd0hms4v";
|
|
};
|
|
}
|
|
];
|
|
};
|
|
};
|
|
}
|