Convert Zsh configuration to module

This commit is contained in:
Yorick Barbanneau 2023-12-30 13:20:08 +01:00
parent 46384d49c1
commit 20823fcb7b
4 changed files with 77 additions and 69 deletions

View file

@ -1,7 +1,6 @@
{ ... }:
{
imports = [
./zsh.nix
./git.nix
./pass.nix
./gnupg.nix

View file

@ -1,68 +0,0 @@
{ pkgs, ... }:
{
programs.zsh = {
enable = true;
dotDir = ".config/zsh";
defaultKeymap = "viins";
enableCompletion = true;
history = {
ignoreAllDups = true;
save = 10000;
share = true;
path = "$HOME/.local/share/zsh/history";
};
historySubstringSearch = {
enable = true;
searchDownKey = "^[OB";
searchUpKey = "^[OA";
};
completionInit = ''
autoload -Uz compinit
for dump in ''${ZDOTDIR}/.zcompdump(N.mh+24); do
compinit
done
compinit -C
'';
plugins = [
{
name = "pure";
src = pkgs.fetchFromGitHub {
owner = "sindresorhus";
repo = "pure";
rev = "v1.21.0";
hash = "sha256-YfasTKCABvMtncrfoWR1Su9QxzCqPED18/BTXaJHttg=";
};
}
{
name = "base16-shell";
src = pkgs.fetchFromGitHub {
owner = "chriskempson";
repo = "base16-shell";
rev = "588691ba71b47e75793ed9edfcfaa058326a6f41";
hash = "sha256-X89FsG9QICDw3jZvOCB/KsPBVOLUeE7xN3VCtf0DD3E=";
};
}
{
name = "fast-syntax-highlighting";
src = pkgs.fetchFromGitHub {
owner = "zdharma-continuum";
repo = "fast-syntax-highlighting";
rev = "v1.55";
hash = "sha256-DWVFBoICroKaKgByLmDEo4O+xo6eA8YO792g8t8R7kA=";
};
}
{
name = "history-search-multi-word";
src = pkgs.fetchFromGitHub {
owner = "zdharma-continuum";
repo = "history-search-multi-word";
rev = "c4dcddc1cd17e7e0909471703f3526170db0f475";
hash = "sha256-KgKm9qzFnwXDXwmTruPgC0tjmiTY5AiGdrWW4zDWUF4=";
};
}];
localVariables = {
BASE16_THEME = "$HOME/.config/zsh/plugins/base16";
};
};
}

View file

@ -0,0 +1,76 @@
{ lib, config, pkgs, ... }:
with lib;
let
cfg = config.modules.cli.zsh;
in
{
options.modules.cli.zsh = {
enable = mkEnableOption "enable Zsh configuration";
};
config = mkIf cfg.enable {
programs.zsh = {
enable = true;
dotDir = ".config/zsh";
defaultKeymap = "viins";
enableCompletion = true;
history = {
ignoreAllDups = true;
save = 10000;
share = true;
path = "$HOME/.local/share/zsh/history";
};
historySubstringSearch = {
enable = true;
searchDownKey = "^[OB";
searchUpKey = "^[OA";
};
completionInit = ''
autoload -Uz compinit
for dump in ''${ZDOTDIR}/.zcompdump(N.mh+24); do
compinit
done
compinit -C
'';
plugins = [
{
name = "pure";
src = pkgs.fetchFromGitHub {
owner = "sindresorhus";
repo = "pure";
rev = "v1.21.0";
hash = "sha256-YfasTKCABvMtncrfoWR1Su9QxzCqPED18/BTXaJHttg=";
};
}
{
name = "base16-shell";
src = pkgs.fetchFromGitHub {
owner = "chriskempson";
repo = "base16-shell";
rev = "588691ba71b47e75793ed9edfcfaa058326a6f41";
hash = "sha256-X89FsG9QICDw3jZvOCB/KsPBVOLUeE7xN3VCtf0DD3E=";
};
}
{
name = "fast-syntax-highlighting";
src = pkgs.fetchFromGitHub {
owner = "zdharma-continuum";
repo = "fast-syntax-highlighting";
rev = "v1.55";
hash = "sha256-DWVFBoICroKaKgByLmDEo4O+xo6eA8YO792g8t8R7kA=";
};
}
{
name = "history-search-multi-word";
src = pkgs.fetchFromGitHub {
owner = "zdharma-continuum";
repo = "history-search-multi-word";
rev = "c4dcddc1cd17e7e0909471703f3526170db0f475";
hash = "sha256-KgKm9qzFnwXDXwmTruPgC0tjmiTY5AiGdrWW4zDWUF4=";
};
}];
localVariables = {
BASE16_THEME = "$HOME/.config/zsh/plugins/base16";
};
};
};
}

View file

@ -3,6 +3,7 @@
imports = [
./cli/neovim
./cli/vifm
./cli/zsh
./desktop/sway
./gaming/lutris
./video/kdenlive