-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfiguration-darwin.nix
276 lines (244 loc) · 6.79 KB
/
configuration-darwin.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
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
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
# Tangled from README.org
# This is a nix-darwin config
{ pkgs, lib, inputs, config, username, ... }: {
imports = [
# import modules into our nix-darwin config
./emacs/nix-darwin.nix
./system/darwin
];
# List packages installed in system profile. To search by name, run:
# $ nix-env -qaP | grep wget
environment.systemPackages = with pkgs; [
# common Darwin packages
asciinema
bat
checkmake
exercism
gh
gleam
gnumake
gnupg
gotop
hexyl
html-tidy
htop
httpie
httplab
jq
kakoune
nodePackages.typescript-language-server
nodejs
pqrs
nixpkgs-fmt
redis
shell-gpt
shellcheck
shfmt
sqlite-interactive
tree
tree-sitter
vim
xxd
yq
inputs.devenv.packages.${system}.default
devbox
pass
nushell
wezterm
pdftk
hunspell
hunspellDicts.nl_NL
hunspellDicts.en_US
hunspellDicts.de_DE
hunspellDicts.he_IL
hunspellDicts.es-any
hunspellDicts.fr-any
] ++ (if system == "aarch64-darwin" then [
# ARM-only packages
] else [
# Intel-only packages
# Darwin packages for Intel-only
gdb
ghidra-bin
]);
environment.interactiveShellInit = lib.strings.concatStrings [
''
eval "''$(${config.homebrew.brewPrefix}/brew shellenv)";
''
];
# General nix-darwin settings
nix.enable = true;
nix.package = pkgs.nix;
# Necessary for using flakes on this system.
nix.settings.experimental-features = "nix-command flakes";
# Adding trusted users for devenv to use Cachix
nix.settings.trusted-users = [
"root"
"vidbina"
];
# NOTE: Copied from home-linux.nix
programs.gnupg.agent = {
enable = true;
enableSSHSupport = true;
};
# Create /etc/zshrc that loads the nix-darwin environment.
# NOTE: Copied from common.nix
programs.zsh = {
enable = true; # default shell on catalina
enableSyntaxHighlighting = true;
# Used to be initExtraBeforeCompInit
# in nix-darwin, interactiveShellInit is called before compinit
# see https://github.com/LnL7/nix-darwin/blob/80bb201f4925cdda5a7a3c7b1900fb26bb2af2e8/modules/programs/zsh/default.nix#L168-L176
promptInit = ''
setopt histignorespace # keeps lines preceded with SPACE out of history
setopt INTERACTIVE_COMMENTS # allow inline comments like this one
# https://github.com/akermu/emacs-libvterm#directory-tracking-and-prompt-tracking
vterm_printf(){
if [ -n "$TMUX" ] && ([ "''${TERM%%-*}" = "tmux" ] || [ "''${TERM%%-*}" = "screen" ] ); then
# Tell tmux to pass the escape sequences through
printf "\ePtmux;\e\e]%s\007\e\\" "$1"
elif [ "''${TERM%%-*}" = "screen" ]; then
# GNU screen (screen, screen-256color, screen-256color-bce)
printf "\eP\e]%s\007\e\\" "$1"
else
printf "\e]%s\e\\" "$1"
fi
}
if [[ "$INSIDE_EMACS" = 'vterm' ]]; then
alias clear='vterm_printf "51;Evterm-clear-scrollback";tput clear'
fi
vterm_prompt_end() {
vterm_printf "51;A";
}
setopt PROMPT_SUBST
PROMPT="↪ %(?.%F{green}√.%F{red}%?)%f" # error state
PROMPT="$PROMPT → %F{yellow}%~%f" # pwd
PROMPT="$PROMPT @ %F{magenta}%D{%Y.%m.%d} %B%F{blue}%T%f%b" # date/time
PROMPT="$PROMPT"$'\n'
PROMPT="$PROMPT%F{green}>%f " # prompt
PROMPT=$PROMPT'%{$(vterm_prompt_end)%}'
vterm_cmd() {
local vterm_elisp
vterm_elisp=""
while [ $# -gt 0 ]; do
vterm_elisp="$vterm_elisp""$(printf '"%s" ' "$(printf "%s" "$1" | sed -e 's|\\|\\\\|g' -e 's|"|\\"|g')")"
shift
done
vterm_printf "51;E$vterm_elisp"
}
# Workaround to open new tab at pwd
# See https://apple.stackexchange.com/a/340778
# http://superuser.com/a/315029/4952
# Set Apple Terminal.app to resume directory... still necessary 2018-10-26
if [[ $TERM_PROGRAM == "Apple_Terminal" ]] && [[ -z "$INSIDE_EMACS" ]] {
function chpwd {
local SEARCH=' '
local REPLACE='%20'
local PWD_URL="file://$HOSTNAME''${PWD//$SEARCH/$REPLACE}"
printf '\e]7;%s\a' "$PWD_URL"
}
chpwd
}
# Use vim bindings in zsh
bindkey -v
# https://unix.stackexchange.com/a/30169
bindkey '^R' history-incremental-search-backward
'';
};
# Set Git commit hash for darwin-version.
system.configurationRevision = inputs.self.rev or inputs.self.dirtyRev or null;
system.keyboard.enableKeyMapping = true;
system.keyboard.remapCapsLockToControl = true;
# Used for backwards compatibility, please read the changelog before changing.
# $ darwin-rebuild changelog
system.stateVersion = 4;
system = {
defaults.CustomUserPreferences = {
"com.microsoft.VSCode" = {
"ApplePressAndHoldEnabled" = false;
};
};
};
users.users.vidbina = {
home = "/Users/vidbina";
};
homebrew = {
enable = true;
global = {
autoUpdate = true; # same as default
};
onActivation = {
autoUpdate = false; # same as default
cleanup = "uninstall";
extraFlags = [
"--verbose"
];
upgrade = false; # same as default
};
brews = [
"smudge/smudge/nightlight"
"pidof"
"coreutils"
"wimlib"
"wireguard-tools"
"pcalc"
];
casks = builtins.filter (x: x != null) [
# Software Development
"iterm2"
"kitty"
# Design
"figma"
"drawio"
# Containerization & Virtualization
"docker"
"utm"
# Productivity
"google-drive"
"linear-linear"
"logseq" # FLOSS (compared to Obsidian) but no mobile app
"notion"
"obsidian" # best-in-class with mobile app support
"raycast"
"zoom"
# Android
"android-file-transfer"
# Devtools
# Go to top-right Settings gear > VSCode Import > Start Import
"cursor"
"warp"
# Entertainment
"spotify"
"steam"
"tidal"
# Social
"discord"
"signal"
"slack"
"telegram"
"whatsapp"
"1password"
"1password-cli"
(if pkgs.system == "aarch64-darwin" then "chatgpt" else null)
"obs" # for streaming
"spotify"
];
masApps = {
"Xcode" = 497799835;
"Bitwarden" = 1352778147;
"Perplexity" = 6714467650;
"Hidden Bar" = 1452453066;
"Remarkable Desktop" = 1276493162;
};
};
nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
"vscode"
];
nixpkgs.overlays = [
(self: super: {
# nix-darwin overlays
my-vscode-extensions = inputs.vscode-extensions.extensions.${pkgs.system};
})
];
environment.pathsToLink = [ "/share/myspell" "/share/hunspell" ];
}