From 20823fcb7b264a94a4a7757a89f288f0d3ec0f70 Mon Sep 17 00:00:00 2001 From: Yorick Barbanneau Date: Sat, 30 Dec 2023 13:20:08 +0100 Subject: [PATCH] Convert Zsh configuration to module --- home-manager/cli/default.nix | 1 - home-manager/cli/zsh.nix | 68 --------------------- modules/home-manager/cli/zsh/default.nix | 76 ++++++++++++++++++++++++ modules/home-manager/default.nix | 1 + 4 files changed, 77 insertions(+), 69 deletions(-) delete mode 100644 home-manager/cli/zsh.nix create mode 100644 modules/home-manager/cli/zsh/default.nix diff --git a/home-manager/cli/default.nix b/home-manager/cli/default.nix index d6db79e..60c17db 100644 --- a/home-manager/cli/default.nix +++ b/home-manager/cli/default.nix @@ -1,7 +1,6 @@ { ... }: { imports = [ - ./zsh.nix ./git.nix ./pass.nix ./gnupg.nix diff --git a/home-manager/cli/zsh.nix b/home-manager/cli/zsh.nix deleted file mode 100644 index 3f14b12..0000000 --- a/home-manager/cli/zsh.nix +++ /dev/null @@ -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"; - }; - }; -} diff --git a/modules/home-manager/cli/zsh/default.nix b/modules/home-manager/cli/zsh/default.nix new file mode 100644 index 0000000..8fde37b --- /dev/null +++ b/modules/home-manager/cli/zsh/default.nix @@ -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"; + }; + }; + }; +} diff --git a/modules/home-manager/default.nix b/modules/home-manager/default.nix index 97f7cb2..0e02297 100644 --- a/modules/home-manager/default.nix +++ b/modules/home-manager/default.nix @@ -3,6 +3,7 @@ imports = [ ./cli/neovim ./cli/vifm + ./cli/zsh ./desktop/sway ./gaming/lutris ./video/kdenlive