From 12399cb846a7b97ba6d8785d90daf033fd0b97ac Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Sun, 7 Jun 2015 23:59:15 +0200 Subject: ZSH config --- bragi.nix | 1 + custom/antigen.nix | 18 ++++++++++++++++++ custom/zsh.nix | 40 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 59 insertions(+) create mode 100644 custom/antigen.nix create mode 100644 custom/zsh.nix diff --git a/bragi.nix b/bragi.nix index dd686033..a4ef67ab 100644 --- a/bragi.nix +++ b/bragi.nix @@ -5,6 +5,7 @@ [ ./bragi-hw.nix ./customized/autofs.nix + ./custom/zsh.nix ]; boot.loader.grub.enable = true; diff --git a/custom/antigen.nix b/custom/antigen.nix new file mode 100644 index 00000000..07fc41c6 --- /dev/null +++ b/custom/antigen.nix @@ -0,0 +1,18 @@ +{ stdenv +, fetchgit +}: + +stdenv.mkDerivation rec { + name="antigen"; + src = fetchgit { + inherit name; + url = https://github.com/zsh-users/antigen.git; + rev = "30098c1d9955b8548aa827588c0d2c9be077c6f2"; + sha256 = "7cb3a75d06fb1e09077703ff0f056f0bfde98b89384afe43ecdc4a42af8e156c"; + }; + builder = builtins.toFile "builder.sh" '' + source $stdenv/setup + + cp -r $src $out + ''; +} diff --git a/custom/zsh.nix b/custom/zsh.nix new file mode 100644 index 00000000..05f43410 --- /dev/null +++ b/custom/zsh.nix @@ -0,0 +1,40 @@ +{ config, pkgs, ... }: +let + antigen = pkgs.callPackage (import ./antigen.nix) {}; +in rec { + programs.zsh.enable = true; + programs.zsh.shellAliases = { + less = "less -R"; + ls = "ls --color=auto"; + l = "ls -lhAF"; + ll = "l --color=always L"; + ".." = "cd .."; + }; + programs.zsh.interactiveShellInit = '' + setopt clobber + setopt nobeep + + alias -g L='|less' + alias -g S='&> /dev/null' + alias -g G='|grep --color=auto' + alias -g B='&> /dev/null &!' + + cl() { cd; clear } + ''; + programs.zsh.promptInit = '' + bindkey -e + source ${antigen}/antigen.zsh + + antigen use oh-my-zsh + antigen bundles <