-
Notifications
You must be signed in to change notification settings - Fork 44
/
shell.nix
75 lines (74 loc) · 1.92 KB
/
shell.nix
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
{ config, lib, pkgs, ... }:
let
functions = builtins.readFile ./functions.sh;
aliases = rec {
ls = "${pkgs.coreutils}/bin/ls --color=auto -h";
la = "${ls} -a";
ll = "${ls} -la";
lt = "${ls} -lat";
} // lib.optionalAttrs pkgs.stdenvNoCC.isDarwin rec {
# darwin specific aliases
ibrew = "arch -x86_64 brew";
abrew = "arch -arm64 brew";
};
in
{
programs.zsh =
let
mkZshPlugin = { pkg, file ? "${pkg.pname}.plugin.zsh" }: rec {
name = pkg.pname;
src = pkg.src;
inherit file;
};
in
{
enable = true;
autocd = true;
dotDir = ".config/zsh";
localVariables = {
LANG = "en_US.UTF-8";
GPG_TTY = "/dev/ttys000";
DEFAULT_USER = "${config.home.username}";
CLICOLOR = 1;
LS_COLORS = "ExFxBxDxCxegedabagacad";
TERM = "xterm-256color";
};
shellAliases = aliases;
initExtraBeforeCompInit = ''
fpath+=~/.zfunc
'';
initExtra = ''
${functions}
${lib.optionalString pkgs.stdenvNoCC.isDarwin ''
if [[ -d /opt/homebrew ]]; then
eval "$(/opt/homebrew/bin/brew shellenv)"
fi
''}
unset RPS1
'';
profileExtra = ''
${lib.optionalString pkgs.stdenvNoCC.isLinux "[[ -e /etc/profile ]] && source /etc/profile"}
'';
plugins = with pkgs; [
(mkZshPlugin { pkg = zsh-autopair; })
(mkZshPlugin { pkg = zsh-completions; })
(mkZshPlugin { pkg = zsh-autosuggestions; })
(mkZshPlugin {
pkg = zsh-fast-syntax-highlighting;
file = "fast-syntax-highlighting.plugin.zsh";
})
(mkZshPlugin { pkg = zsh-history-substring-search; })
];
oh-my-zsh = {
enable = true;
plugins = [ "git" "sudo" ];
};
};
programs.bash = {
enable = true;
shellAliases = aliases;
initExtra = ''
${functions}
'';
};
}