-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapply_configs_core.jsonnet
218 lines (193 loc) · 8.42 KB
/
apply_configs_core.jsonnet
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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
local ext_vars = {
home: std.extVar('home'),
cwd: std.extVar('cwd'),
is_osx: std.extVar('kernel') == 'darwin',
is_localhost: std.extVar('is_localhost') == 'true',
hostname: std.extVar('hostname')
};
local config_dir = '.config/dotShell';
local jsonnet_maps = [
['git/gitconfig.jsonnet', 'gen/gitconfig.ini', '.gitconfig'],
# env_vars needs to be in the home directory for bootstrapping zsh
['shell/env_vars.jsonnet', 'gen/env_vars.sh', '.env_vars.sh'],
['konsole/konsolerc.jsonnet', 'gen/konsolerc.ini', '.config/konsolerc'],
['konsole/konsole_color_funcs.jsonnet', 'gen/konsole_color_funcs.sh', config_dir + '/'],
['shell/iterm2_color_funcs.jsonnet', 'gen/iterm2_color_funcs.sh', config_dir + '/'],
];
local jsonnet_localhost_mac_maps = [
['vscode/user_settings.jsonnet', 'gen/vscode_user_settings.json', 'Library/Application Support/Code/User/settings.json']
];
local jsonnet_multi_maps = [
['konsole/LocalProfiles.jsonnet', 'gen/konsole_profiles', '.local/share/konsole'],
['konsole/ColorConfigs.jsonnet', 'gen/konsole_colors', '.local/share/konsole'],
];
local curl_maps = [
['https://raw.githubusercontent.com/git/git/master/contrib/completion/git-prompt.sh', 'curl/git-prompt.sh', config_dir + '/completion/'],
['https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash', 'curl/git-completion.bash', config_dir + '/completion/'],
['https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.zsh', 'curl/git-completion.zsh', config_dir + '/zfuncs/_git'],
['https://iterm2.com/shell_integration/zsh', 'curl/iterm2_shell_integration.zsh', config_dir + '/'],
['https://iterm2.com/shell_integration/bash', 'curl/iterm2_shell_integration.bash', config_dir + '/'],
['https://raw.githubusercontent.com/eza-community/eza/main/completions/zsh/_eza', 'curl/_eza', config_dir + '/zfuncs/'],
['https://raw.githubusercontent.com/mafredri/zsh-async/v1.8.6/async.zsh', 'curl/async.zsh', config_dir + '/zfuncs/async'],
];
local file_maps = [
['bash/profile.sh', '.profile'],
['bash/bashrc.sh', '.bashrc'],
['ghostty/ghostty_config.properties', '.config/ghostty/config'],
['ghostty/xterm-ghostty.terminfo', config_dir + '/'],
['shell/env_funcs.sh', config_dir + '/'],
['shell/iterm2_funcs.sh', config_dir + '/'],
['shell/osx_funcs.sh', config_dir + '/'],
['shell/util_funcs.sh', config_dir + '/'],
['shell/android_funcs.sh', config_dir + '/'],
['zsh/zshrc.zsh', '.zshrc'],
['zsh/zprofile.zsh', '.zprofile'],
['zsh/zshenv.zsh', '.zshenv'],
['zsh/batcharge.py', config_dir + '/'],
['vim/vimrc.vim', '.vimrc'],
['tmux/tmux.conf', '.tmux.conf'],
['tmux/vscode-tmux.conf', config_dir + '/'],
];
local directory_maps = [
['vim/colors', '.vim/colors'],
['svg', config_dir + '/svg'],
];
local vim_pack_plugin_start_repos = [
# Syntax highlighting for AOSP specific files
'https://github.com/rubberduck203/aosp-vim.git',
# Lean & mean status/tabline for vim that's light as air
'https://github.com/vim-airline/vim-airline.git',
# Kotlin plugin for Vim. Featuring: syntax highlighting, basic indentation, Syntastic support
'https://github.com/udalov/kotlin-vim.git',
# A tree explorer plugin for vim.
'https://github.com/preservim/nerdtree.git',
# A Vim plugin which shows git diff markers in the sign column
# and stages/previews/undoes hunks and partial hunks.
'https://github.com/airblade/vim-gitgutter.git',
# 💻 Terminal manager for (neo)vim
'https://github.com/voldikss/vim-floaterm.git',
# Check syntax in Vim asynchronously and fix files, with Language Server Protocol (LSP) support
'https://github.com/dense-analysis/ale.git',
# Neovim plugin for GitHub Copilot
'https://github.com/github/copilot.vim.git',
# Vim plugin to diff two directories
'https://github.com/will133/vim-dirdiff.git',
# colorschemes for Vim
'https://github.com/vim/colorschemes.git',
# Retro groove color scheme for Vim
'https://github.com/morhetz/gruvbox.git',
];
local vim_pack_plugin_opt_repos = [
# A dark Vim/Neovim color scheme inspired by Atom's One Dark syntax theme.
'https://github.com/joshdick/onedark.vim.git'
];
local zsh_plugin_repos = [
# Fish shell like syntax highlighting for Zsh.
'https://github.com/zsh-users/zsh-syntax-highlighting.git'
];
local macros = {
'#pragma once': [
'[ -n "${PRAGMA_@@FILE_NAME}" ] && return',
'PRAGMA_@@FILE_NAME=0',
],
'#pragma watermark': [
'# Generated by dotFiles scripting tools - @@NOW',
],
'#pragma validate-dotfiles': [
'[[ -e ~/.env_vars.sh ]] || return',
],
};
local remote_post_install_commands = [
'tic -x $DOTFILES_CONFIG_ROOT/xterm-ghostty.terminfo',
];
// Colors for less binary
// Source: https://github.com/Valloric/dotfiles/blob/master/less/LESS_TERMCAP
// Source: http://unix.stackexchange.com/a/147
// More info: http://unix.stackexchange.com/a/108840
local less_termcaps_directives = {
// LESS_TERMCAP_DEBUG: 0, // set this to see tags printed in less.
LESS_TERMCAP_mb: 'tput bold; tput setaf 2', // green
LESS_TERMCAP_md: 'tput bold; tput setaf 6', // cyan
LESS_TERMCAP_me: 'tput sgr0',
LESS_TERMCAP_so: 'tput bold; tput setaf 3; tput setab 4', // yellow on blue
LESS_TERMCAP_se: 'tput rmso; tput sgr0',
LESS_TERMCAP_us: 'tput smul; tput bold; tput setaf 7', // white
LESS_TERMCAP_ue: 'tput rmul; tput sgr0',
LESS_TERMCAP_mr: 'tput rev',
LESS_TERMCAP_mh: 'tput dim',
LESS_TERMCAP_ZN: 'tput ssubm',
LESS_TERMCAP_ZV: 'tput rsubm',
LESS_TERMCAP_ZO: 'tput ssupm',
LESS_TERMCAP_ZW: 'tput rsupm',
};
local less_termcaps_properties = {
GROFF_NO_SGR: 1, // For Konsole and Gnome-terminal
LESS: "--RAW-CONTROL-CHARS",
// https://stackoverflow.com/questions/1049350/how-to-make-less-indicate-location-in-percentage/19871578#19871578
MANPAGER: 'less -s -M +Gg',
};
local env_vars = {
properties: {
// XDG_CONFIG_HOME: '${XDG_CONFIG_HOME:-$HOME/.config}',
DOTFILES_CONFIG_ROOT: '$HOME/' + config_dir,
LSCOLORS: 'GxDxbxhbcxegedabagacad',
LS_COLORS: 'di=1;36:ln=1;33:so=31:pi=37;41:ex=32:bd=34;46:cd=34;43:su=30;41:sg=30;46:tw=30;42:ow=30;43',
} + less_termcaps_properties,
interactive_directives: less_termcaps_directives,
aliases: {
'...': 'cd ../..',
},
directives: {}
};
local localhost_env_vars = env_vars + {
properties+: {
DOTFILES_SRC_HOME: ext_vars.cwd,
},
aliases+: {
dotGo: 'pushd $DOTFILES_SRC_HOME'
},
};
local Host(hostname, home, icon, color, primary_wallpaper, android_wallpaper) = {
hostname:
if hostname != null then hostname
else if ext_vars.is_localhost then ext_vars.hostname
else 'localhost',
home: if home != null then home else ext_vars.home,
color:: color,
primary_wallpaper:: primary_wallpaper,
android_wallpaper:: android_wallpaper,
icon:: icon,
is_localhost:: $.hostname == ext_vars.hostname && ext_vars.is_localhost,
is_osx:: $.is_localhost && ext_vars.is_osx,
config_dir: config_dir,
curl_maps: curl_maps,
jsonnet_maps: jsonnet_maps +
if $.is_osx then jsonnet_localhost_mac_maps else [],
jsonnet_multi_maps: jsonnet_multi_maps,
directory_maps: directory_maps,
macros: macros,
post_install_commands: if $.is_localhost then [] else remote_post_install_commands,
file_maps: file_maps +
if primary_wallpaper != null then [[primary_wallpaper.local_path, primary_wallpaper.target_path($)]] else [] +
if android_wallpaper != null then [[android_wallpaper.local_path, android_wallpaper.target_path($)]] else [],
env_vars:: (if $.is_localhost then localhost_env_vars else env_vars) + {
properties+: {
HOST_COLOR: color.hexcolor,
ANDROID_HOME: if ext_vars.is_osx
then '~/Library/Android/sdk'
else '$HOME/android_sdk',
[if primary_wallpaper != null then 'PRIMARY_WALLPAPER']: primary_wallpaper.target_path($),
[if android_wallpaper != null then 'ANDROID_WALLPAPER']: android_wallpaper.target_path($),
},
},
};
{
hostname: ext_vars.hostname,
is_osx: ext_vars.is_osx,
cwd: ext_vars.cwd,
config_dir: config_dir,
vim_pack_plugin_start_repos: vim_pack_plugin_start_repos,
vim_pack_plugin_opt_repos: vim_pack_plugin_opt_repos,
zsh_plugin_repos: zsh_plugin_repos,
Host: Host,
}