summaryrefslogtreecommitdiff
path: root/zsh/default.nix
blob: c324a338d83e3c50989965a8cacb69046496edac (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
42
43
44
45
46
47
48
49
50
51
52
53
54
{

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

}: rec {

  ohMyZsh = ./oh-my-zsh;

  bin = pkgs.buildEnv {
    name = "mediocregopher-bin";
    paths = [
      (pkgs.stdenv.mkDerivation {
        name = "mediocregopher-default-bin";
        src = ../bin;
        builder = builtins.toFile "builder.sh" ''
          source $stdenv/setup
          mkdir -p "$out"
          cp -rL "$src" "$out"/bin
        '';
      })
    ] ++ (
      builtins.map (cFn: cFn pkgs) config.binExtra
    );
  };

  zshrc = pkgs.writeTextDir ".zshrc" ''

    # 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 PATH=${bin}/bin:$PATH

    #Global stuff shitty programs use
    export EDITOR=~/.nix-profile/bin/nvim

    # GPG is needy
    export GPG_TTY=$(tty)

    . ${./zshrc}
    . ${./aliases}
    . ${pkgs.nix}/etc/profile.d/nix.sh
  '';

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