aboutsummaryrefslogtreecommitdiff
path: root/modules/zsh/default.nix
blob: b1ed82e21d05227154a31eaef7ce9f0555b598d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
{ config, lib, pkgs, ... }:
let
  cfg = config.modules.zsh;

  inherit (lib) mkEnableOption mkOption mkIf types;
in
{
  options.modules.zsh = {
    enable = mkEnableOption "zsh";
    theme = mkOption {
      type = types.str;
      description = "name of zsh theme to apply";
      default = "stefan";
    };
  };

  config = mkIf cfg.enable {
    home.packages = with pkgs; [
      zsh
      oh-my-zsh
      zsh-autosuggestions
    ];

    home.file.".oh-my-zsh/themes" = {
      source = ./themes;
      recursive = true;
    };

    programs.zsh = {
    	enable = true;
      enableCompletion = true;
      autosuggestion.enable = true;
      oh-my-zsh = {
        enable = true;
      };
      initExtra = ''
        source ~/.oh-my-zsh/themes/${cfg.theme}.zsh-theme 
      '';
    };
  };
}