-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdarwin.nix
More file actions
234 lines (213 loc) · 5.17 KB
/
Copy pathdarwin.nix
File metadata and controls
234 lines (213 loc) · 5.17 KB
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
{ pkgs, self, config, ... }: {
# General Config
# --------------
networking.hostName = "deucalion";
nix.settings.experimental-features = "nix-command flakes"; # Necessary for using flakes on this system.
system.configurationRevision = self.rev or self.dirtyRev or null; # Set Git commit hash for darwin-version.
system.stateVersion = 6; # Used for backwards compatibility, please read the changelog before changing. $ darwin-rebuild changelog
nixpkgs.hostPlatform = "aarch64-darwin"; # The platform the configuration will be used on.
# Security
# --------
security.pam.services.sudo_local.touchIdAuth = true; # Enable Touch ID for sudo
# System Packages
# ---------------
environment.systemPackages = with pkgs; [
curl
git
ripgrep
fd
tree
wget
htop
emacs-macport
];
nix.enable = false;
# Homebrew
# ---------
homebrew = {
enable = true;
onActivation = {
autoUpdate = true;
cleanup = "zap";
};
brews = [
"llvm"
# For clang-format & clang tidy
# ln -s $(brew --prefix llvm)/bin/clang-format /opt/homebrew/bin/clang-format
# ln -s $(brew --prefix llvm)/bin/clang-tidy /opt/homebrew/bin/clang-tidy
"autoconf"
"autoconf-archive"
"automake"
"ccache"
"cmake"
"xmake"
"gdb"
"p7zip"
"nasm"
"ninja"
"pkg-config"
"swiftformat"
"libpq"
"mosh"
"tmux"
"tpm"
"mg"
"ag"
"eza"
"nmap"
"dust"
"delta"
"fzf"
"glow"
"mpv"
"bandwhich"
"difftastic"
"pandoc"
"pdflatex"
"zola"
"go"
"uv"
"llama.cpp"
"minify"
"podman"
"podman-compose"
"spaceship"
"node"
"pnpm"
"pre-commit"
"zsh-syntax-highlighting"
"zsh-autosuggestions"
"zsh-autopair"
];
# Mac App Store applications
masApps = {
# "App Name" = App Store ID;
"Xcode" = 497799835;
};
# Homebrew casks
casks = [
"orion"
"kdenlive"
"waterfox"
"netnewswire"
"the-unarchiver"
"wezterm"
"ghostty"
"godot"
"inkscape"
"hammerspoon"
"cyberduck"
"visual-studio-code"
"iina"
"cap"
"keka"
"itsycal"
"vellum"
"numi"
"keycastr"
"openemu"
"calibre"
"swiftformat-for-xcode"
"little-snitch"
"rectangle"
"nextcloud"
"obsidian"
"squeak"
"telegram"
"orbstack"
];
};
# Global env vars
# ---------------
environment.variables = {
EDITOR = "mg";
LANG = "en_US.UTF-8";
LC_ALL = "en_US.UTF-8";
};
# Symlinks
# --------
system.activationScripts.extraActivation.text = let
homeDir = config.users.users.beshr.home;
repoPath = "${homeDir}/src/system";
# Define symlinks as source -> target pairs
symlinks = [
# Format: [source target]
# - Nix Darwin
["${repoPath}/nix-darwin" "/etc/nix-darwin"]
# - Emacs
["${repoPath}/emacs" "${homeDir}/.emacs.d"]
# - Other dotfiles
["${repoPath}/wezterm.lua" "${homeDir}/.wezterm.lua"]
["${repoPath}/zshrc.zsh" "${homeDir}/.zshrc"]
["${repoPath}/tmux.conf" "${homeDir}/.tmux.conf"]
["${repoPath}/gitconfig" "${homeDir}/.gitconfig"]
["${repoPath}/ghostty" "${homeDir}/.config/ghostty/config"]
];
# Function to generate symlink commands
mkSymlinkCmd = link: let
source = builtins.elemAt link 0;
target = builtins.elemAt link 1;
in ''
# For ${source} -> ${target}
if [ -L "${target}" ]; then
echo "Removing existing symlink at ${target}..."
rm "${target}"
elif [ -e "${target}" ]; then
echo "Backing up existing file at ${target}..."
mv "${target}" "${target}.backup-$(date +%Y%m%d-%H%M%S)"
fi
echo "Creating symlink: ${source} -> ${target}"
mkdir -p "$(dirname "${target}")"
ln -sfn "${source}" "${target}"
'';
in ''
echo "Setting up symlinks..."
${builtins.concatStringsSep "\n" (map mkSymlinkCmd symlinks)}
echo "Symlink setup complete!"
'';
# Users
# -----
users.users.beshr = {
name = "beshr";
home = "/Users/beshr";
shell = pkgs.zsh;
description = "Beshr Kayali Reinholdsson";
gid = 20; # Staff
isHidden = false;
};
# Fonts
# -----
fonts.packages = with pkgs; [
# Individual nerd fonts packages
nerd-fonts.jetbrains-mono
nerd-fonts.fira-code
# Regular fonts
fira-code
jetbrains-mono
inter
];
# System defaults
system.defaults = {
screencapture.location = "~/Pictures/screenshots";
screencapture.disable-shadow = true;
SoftwareUpdate.AutomaticallyInstallMacOSUpdates = true;
NSGlobalDomain = {
AppleKeyboardUIMode = 3;
};
dock = {
autohide = true;
orientation = "left";
show-process-indicators = false;
show-recents = false;
static-only = true;
tilesize = 32;
};
finder = {
AppleShowAllExtensions = true;
ShowPathbar = true;
FXEnableExtensionChangeWarning = false;
FXPreferredViewStyle = "clmv";
ShowStatusBar = true;
};
};
}