From e58196dcc87872d8e2a1dcaebfc612cd2dee56a8 Mon Sep 17 00:00:00 2001 From: alejandro-angulo Date: Sun, 28 Jul 2024 20:51:41 -0700 Subject: [PATCH] Converted zsh from nixosModule to homeModule --- homes/x86_64-linux/alejandro/default.nix | 1 + modules/home/tools/zsh/default.nix | 75 +++++++++++++++++++++ modules/{nixos => home}/tools/zsh/p10k.zsh | 0 modules/nixos/tools/zsh/default.nix | 78 ---------------------- 4 files changed, 76 insertions(+), 78 deletions(-) create mode 100644 modules/home/tools/zsh/default.nix rename modules/{nixos => home}/tools/zsh/p10k.zsh (100%) delete mode 100644 modules/nixos/tools/zsh/default.nix diff --git a/homes/x86_64-linux/alejandro/default.nix b/homes/x86_64-linux/alejandro/default.nix index 4680d2c..e1a127e 100644 --- a/homes/x86_64-linux/alejandro/default.nix +++ b/homes/x86_64-linux/alejandro/default.nix @@ -15,6 +15,7 @@ tools = { direnv.enable = true; git.enable = true; + zsh.enable = true; }; }; } diff --git a/modules/home/tools/zsh/default.nix b/modules/home/tools/zsh/default.nix new file mode 100644 index 0000000..a4f7b90 --- /dev/null +++ b/modules/home/tools/zsh/default.nix @@ -0,0 +1,75 @@ +{ + config, + lib, + pkgs, + namespace, + ... +}: let + inherit (lib) mkEnableOption mkIf; + inherit (pkgs) fetchFromGitHub; + + cfg = config.${namespace}.tools.zsh; +in { + options.${namespace}.tools.zsh = { + enable = mkEnableOption "zsh"; + }; + + config = mkIf cfg.enable { + programs.zsh = { + enable = true; + autosuggestion.enable = true; + enableCompletion = true; + envExtra = '' + export PATH=~/.local/bin:$PATH + export EDITOR=nvim + ''; + initExtra = '' + base16_darktooth + bindkey -v + bindkey '^A' beginning-of-line + bindkey '^E' end-of-line + bindkey '^R' history-incremental-search-backward + alias view="nvim -R $1" + alias l='ls -la' + ''; + + plugins = [ + { + name = "zsh-syntax-highlighting"; + src = fetchFromGitHub { + owner = "zsh-users"; + repo = "zsh-syntax-highlighting"; + rev = "0.7.1"; + sha256 = "sha256-gOG0NLlaJfotJfs+SUhGgLTNOnGLjoqnUp54V9aFJg8="; + }; + file = "zsh-syntax-highlighting.zsh"; + } + { + name = "powerlevel10k"; + src = fetchFromGitHub { + owner = "romkatv"; + repo = "powerlevel10k"; + rev = "v1.17.0"; + sha256 = "sha256-fgrwbWj6CcPoZ6GbCZ47HRUg8ZSJWOsa7aipEqYuE0Q="; + }; + file = "powerlevel10k.zsh-theme"; + } + { + name = "powerlevel10k-config"; + src = lib.cleanSource ./.; + file = "p10k.zsh"; + } + { + name = "base16-shell"; + src = fetchFromGitHub { + owner = "chriskempson"; + repo = "base16-shell"; + rev = "588691ba71b47e75793ed9edfcfaa058326a6f41"; + sha256 = "sha256-X89FsG9QICDw3jZvOCB/KsPBVOLUeE7xN3VCtf0DD3E="; + }; + file = "base16-shell.plugin.zsh"; + } + ]; + }; + }; +} diff --git a/modules/nixos/tools/zsh/p10k.zsh b/modules/home/tools/zsh/p10k.zsh similarity index 100% rename from modules/nixos/tools/zsh/p10k.zsh rename to modules/home/tools/zsh/p10k.zsh diff --git a/modules/nixos/tools/zsh/default.nix b/modules/nixos/tools/zsh/default.nix deleted file mode 100644 index 9a0a4ff..0000000 --- a/modules/nixos/tools/zsh/default.nix +++ /dev/null @@ -1,78 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: -with lib; let - cfg = config.aa.tools.zsh; -in { - options.aa.tools.zsh = with types; { - enable = mkEnableOption "zsh"; - }; - - config = mkIf cfg.enable { - # Already set in home-manager below, but without this building fails with - # an assertion error that suggests setting this - programs.zsh.enable = true; - - aa.home.extraOptions = { - programs.zsh = { - enable = true; - autosuggestion.enable = true; - enableCompletion = true; - envExtra = '' - export PATH=~/.local/bin:$PATH - export EDITOR=nvim - ''; - initExtra = '' - base16_darktooth - bindkey -v - bindkey '^A' beginning-of-line - bindkey '^E' end-of-line - bindkey '^R' history-incremental-search-backward - alias view="nvim -R $1" - alias l='ls -la' - ''; - - plugins = with pkgs; [ - { - name = "zsh-syntax-highlighting"; - src = fetchFromGitHub { - owner = "zsh-users"; - repo = "zsh-syntax-highlighting"; - rev = "0.7.1"; - sha256 = "sha256-gOG0NLlaJfotJfs+SUhGgLTNOnGLjoqnUp54V9aFJg8="; - }; - file = "zsh-syntax-highlighting.zsh"; - } - { - name = "powerlevel10k"; - src = fetchFromGitHub { - owner = "romkatv"; - repo = "powerlevel10k"; - rev = "v1.17.0"; - sha256 = "sha256-fgrwbWj6CcPoZ6GbCZ47HRUg8ZSJWOsa7aipEqYuE0Q="; - }; - file = "powerlevel10k.zsh-theme"; - } - { - name = "powerlevel10k-config"; - src = lib.cleanSource ./.; - file = "p10k.zsh"; - } - { - name = "base16-shell"; - src = fetchFromGitHub { - owner = "chriskempson"; - repo = "base16-shell"; - rev = "588691ba71b47e75793ed9edfcfaa058326a6f41"; - sha256 = "sha256-X89FsG9QICDw3jZvOCB/KsPBVOLUeE7xN3VCtf0DD3E="; - }; - file = "base16-shell.plugin.zsh"; - } - ]; - }; - }; - }; -}