forked from kclejeune/system
-
Notifications
You must be signed in to change notification settings - Fork 0
/
shell.nix
executable file
·112 lines (109 loc) · 2.59 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
{
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"
"asdf"
];
};
};
programs.bash = {
enable = true;
shellAliases = aliases;
initExtra = ''
${functions}
if [[ -d "${config.home.homeDirectory}/.asdf/" ]]; then
. "${config.home.homeDirectory}/.asdf/asdf.sh"
. "${config.home.homeDirectory}/.asdf/completions/asdf.bash"
fi
'';
};
# starship - a customizable prompt for any shell
programs.starship = {
enable = true;
# custom settings
settings = {
add_newline = false;
aws.disabled = true;
gcloud.disabled = true;
line_break.disabled = true;
};
};
#autojump - a 'cd' command that learns
programs.autojump = {
enable = true;
};
}