-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommandline.nix
156 lines (126 loc) · 3.64 KB
/
commandline.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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
{ config, pkgs, lib, ... }:
with import ./lib/theme.nix { inherit lib; };
let
dominantEscapeCode = fgEscapeCode config.theme.colors.dominant;
bgDominantEscapeCode = bgEscapeCode config.theme.colors.dominant;
backgroundEscapeCode = fgEscapeCode config.theme.colors.background;
shellScripts = {
split-cue = ./scripts/standalone/split-cue.sh;
};
in
{
nixpkgs.overlays = let
unstable = import <nixpkgs-unstable> {};
in [
(self: super: {
inherit (unstable) starship;
})
];
environment.shellAliases = {
ll = "ls -l";
e = "\${EDITOR}";
cpr = "${pkgs.rsync}/bin/rsync -ah --inplace --info=progress2";
};
programs.bash = {
enableCompletion = true;
interactiveShellInit = ''
eval "$(${pkgs.starship}/bin/starship init bash)"
PATH="${pkgs.pazi}/bin:$PATH"
eval "$(pazi init bash)"
'';
};
programs.zsh = {
enable = true;
interactiveShellInit = with lib;
''
source "${pkgs.grml-zsh-config}/etc/zsh/zshrc"
is4 && xsource "${pkgs.grml-zsh-config}/etc/zsh/keephack"
PATH="${pkgs.pazi}/bin:$PATH"
eval "$(pazi init zsh)"
source "${pkgs.zsh-history-substring-search}/share/zsh-history-substring-search/zsh-history-substring-search.zsh"
alias ${concatStringsSep " "
(mapAttrsToList
(name: script: "${name}=\"${script}\"")
shellScripts)}
function () {
local dominant_escape_code="${dominantEscapeCode}"
local dim_fg_escape_code="${fgEscapeCode config.theme.colors.dimForeground}"
${builtins.readFile ./dotfiles/zshrc}
}
# Grml's ZSH config overrides less variables
export ${concatStringsSep " "
(mapAttrsToList
(variable: value: "${variable}=\"${value}\"")
config.programs.less.envVariables)}
#eval "$(${pkgs.starship}/bin/starship init zsh)"
'';
# otherwise it'll override the grml prompt
promptInit = "";
# Grml handles that, and supports cache (faster!!!)
enableGlobalCompInit = false;
syntaxHighlighting = {
enable = true;
highlighters = [ "main" "brackets" "line" ];
};
shellAliases = {
e = "\${(z)EDITOR}";
};
setOptions = [
"HIST_IGNORE_DUPS" "SHARE_HISTORY" "HIST_FCNTL_LOCK"
"NO_CLOBBER"
"NO_CASE_GLOB"
];
};
users.defaultUserShell = pkgs.zsh;
programs.less = {
envVariables = {
LESS = "-W -z-4 -R -J";
LESS_TERMCAP_mb = dominantEscapeCode;
LESS_TERMCAP_md = dominantEscapeCode;
LESS_TERMCAP_so =
bgDominantEscapeCode + backgroundEscapeCode + "$(tput bold)";
};
};
security.sudo.extraConfig =
let
lectureFile = builtins.toFile "sudoers.lecture" ''
[1m
${dominantEscapeCode}"Bee" careful [34m__
${dominantEscapeCode}with sudo! [34m// \
\\_/ [33m//
[35m'''-.._.-'''-.._.. [33m-(||)(')
''''[0m
'';
in
''
Defaults lecture = always
Defaults lecture_file = "${lectureFile}"
'';
home-manager.users.minijackson = { ... }:
{
xdg.configFile."starship.toml".text = ''
[directory]
fish_style_pwd_dir_length = 2
style = "bold blue"
[git_branch]
symbol = "branch "
[git_status]
ahead = "^"
behind = "v"
deleted = "x"
[jobs]
symbol = "+ "
[package]
symbol = "version "
style = "bold green"
disabled = true
[rust]
symbol = "rust "
style = "bold dimmed yellow"
[nix_shell]
style = "bold blue"
[character]
symbol = ">"
'';
};
}