summaryrefslogtreecommitdiff
path: root/zsh/default.nix
blob: a2073e759450c1463ee042084e40fb073e847dda (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
{

  pkgs ? (import ../pkgs.nix).stable {},
  config,

}: rec {

  zshrc = pkgs.writeTextDir ".zshrc" ''
    # Import before anything else, so that we have the full PATH available for
    # everything following. We prefer a global install (via the system's actual
    # package manager) to using nix in the nix profile.
    if [ -f /etc/profile.d/nix-daemon.sh ]; then
      . /etc/profile.d/nix-daemon.sh
    elif [ -f "$HOME"/.nix-profile/etc/profile.d/nix-daemon.sh ]; then
      . "$HOME"/.nix-profile/etc/profile.d/nix-daemon.sh
    fi

    # oh-my-zsh
    export ZSH=${pkgs.oh-my-zsh}/share/oh-my-zsh
    ZSH_CUSTOM=${./custom}
    ZSH_THEME=mediocregopher
    DISABLE_AUTO_UPDATE=true
    plugins=(git vi-mode)
    source $ZSH/oh-my-zsh.sh

    export TERMINFO_DIRS=${pkgs.ncurses}/lib/terminfo:${./terminfo}

    export BROWSER=${config.browser}

    . ${./zshrc}
    . ${./aliases}
  '';

  zsh = pkgs.writeScriptBin "zsh" ''
    #!${pkgs.bash}/bin/bash
    ZDOTDIR=${zshrc} exec ${pkgs.zsh}/bin/zsh "$@"
  '';
}