Skip to content

Commit 73be1aa

Browse files
authored
chore: modularize flake (#11)
* moduralize darwin * Normalize host layout * Introduce profiles for organization * Remove duplicate allowUnfree * Remove duplicate * Disable ollama service * Made host font overrides additive * Add devShell and formatter * Enable CI on PRs * PR Feedback (Round 1) * PR Feedback (Round 2) * Remove comment * Another pesky leftover comment * run CI lint on linux runners * Fix formatting d3rp * remove nil lsp * DRY devShells * Add deadnix to lint job * Fix another d3rp
1 parent 060e9b4 commit 73be1aa

21 files changed

+453
-320
lines changed

.envrc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# If we are a computer with nix-shell available, then use that to setup
2+
# the build environment with exactly what we need.
3+
if has nix; then
4+
use flake
5+
fi
6+
7+
source_env_if_exists .envrc.local

.github/workflows/ci.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
6+
permissions:
7+
contents: read
8+
9+
concurrency:
10+
group: ci-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
lint:
15+
runs-on: ubuntu-24.04
16+
steps:
17+
- uses: actions/checkout@v4
18+
- uses: DeterminateSystems/nix-installer-action@v19
19+
- uses: DeterminateSystems/magic-nix-cache-action@v13
20+
- name: Check formatting
21+
run: nix develop -c treefmt --ci
22+
- name: Deadnix (fail on unused Nix)
23+
run: nix run nixpkgs#deadnix -- --fail
24+
25+
flake-check:
26+
runs-on: macos-15
27+
needs: lint
28+
steps:
29+
- uses: actions/checkout@v4
30+
- uses: DeterminateSystems/nix-installer-action@v19
31+
- uses: DeterminateSystems/magic-nix-cache-action@v13
32+
- name: Show flake outputs
33+
run: nix flake show
34+
- name: Flake checks (no system builds)
35+
run: nix flake check --keep-going --print-build-logs
36+
37+
eval-hosts:
38+
runs-on: macos-15
39+
needs: flake-check
40+
strategy:
41+
fail-fast: false
42+
matrix:
43+
host: [higgins, benson, spaceblack, dunston]
44+
steps:
45+
- uses: actions/checkout@v4
46+
- uses: DeterminateSystems/nix-installer-action@v19
47+
- uses: DeterminateSystems/magic-nix-cache-action@v13
48+
- name: Evaluate toplevel drv for ${{ matrix.host }}
49+
run: nix eval --raw .#darwinConfigurations.${{ matrix.host }}.config.system.build.toplevel.drvPath
50+
51+

darwin/audio.nix

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
{ ... }:
1+
{ lib, config, ... }:
22

3-
{
3+
lib.mkIf config.profiles.audio.enable {
44
homebrew = {
55
casks = [
66
"ableton-live-suite"

darwin/darwin.nix

Lines changed: 13 additions & 283 deletions
Original file line numberDiff line numberDiff line change
@@ -1,287 +1,17 @@
1-
{ pkgs, user, ... }:
1+
{ ... }:
22

33
{
4-
system.primaryUser = user;
5-
6-
nixpkgs.config.allowUnfree = true;
7-
8-
# Since we are using determinate nix distribution
9-
nix.enable = false;
10-
11-
programs = {
12-
gnupg.agent.enable = true;
13-
zsh.enable = true;
14-
};
15-
16-
system.stateVersion = 4;
17-
18-
environment.systemPackages = with pkgs; [
19-
asitop
20-
autoconf
21-
autoconf-archive
22-
automake
23-
aws-nuke
24-
aws-iam-authenticator
25-
awscli2
26-
btop
27-
cmake
28-
ccache
29-
cocoapods
30-
deno
31-
direnv
32-
doctl
33-
doggo
34-
duckdb
35-
duf
36-
dust
37-
eksctl
38-
emacs
39-
fastfetch
40-
fd
41-
ffmpeg
42-
foreman
43-
fzf
44-
gh
45-
glab
46-
gnupg
47-
go
48-
google-cloud-sdk
49-
k9s
50-
kubernetes-helm
51-
heroku
52-
home-manager
53-
htop
54-
iftop
55-
iperf3
56-
jq
57-
kind
58-
lolcat
59-
neovim
60-
minikube
61-
nasm
62-
netcat
63-
ninja
64-
pinentry_mac
65-
podman
66-
pkg-config
67-
python313
68-
ripgrep
69-
rbenv
70-
qemu
71-
sesh
72-
sketchybar
73-
sketchybar-app-font
74-
socat
75-
terraform
76-
tmux
77-
ugrep
78-
unzip
79-
uv
80-
vim
81-
watchman
82-
yarn
83-
zellij
84-
zoxide
4+
imports = [
5+
./modules/base.nix
6+
./modules/packages.nix
7+
./modules/fonts.nix
8+
./modules/homebrew.nix
9+
./modules/defaults.nix
10+
./modules/activation.nix
11+
./modules/profiles.nix
12+
./audio.nix
13+
./gaming.nix
14+
./photography.nix
15+
./video.nix
8516
];
86-
87-
fonts.packages = with pkgs; [
88-
atkinson-hyperlegible
89-
jetbrains-mono
90-
];
91-
92-
homebrew = {
93-
enable = true;
94-
onActivation = {
95-
autoUpdate = true;
96-
cleanup = "zap";
97-
upgrade = true;
98-
};
99-
brews = [
100-
"gemini-cli"
101-
"pulumi"
102-
"nvm"
103-
"sst/tap/sst"
104-
"sst/tap/opencode"
105-
];
106-
casks = [
107-
"1password"
108-
"1password-cli"
109-
"alcove"
110-
"affinity-photo"
111-
"android-file-transfer"
112-
"balenaetcher"
113-
"bartender"
114-
"betterdisplay"
115-
"bitwarden"
116-
"claude"
117-
"cleanshot"
118-
"crystalfetch"
119-
"cursor"
120-
"discord"
121-
"docker-desktop"
122-
"dropbox"
123-
"elgato-stream-deck"
124-
"expo-orbit"
125-
"figma"
126-
"firefox"
127-
"flirc"
128-
"font-bitstream-vera-sans-mono-nerd-font"
129-
"font-hack-nerd-font"
130-
"font-meslo-lg-nerd-font"
131-
"ghostty"
132-
"gitkraken-cli"
133-
"google-chrome"
134-
"granola"
135-
"iina"
136-
"inkscape"
137-
"istat-menus"
138-
"kiro"
139-
"legcord"
140-
"linear-linear"
141-
"lm-studio"
142-
"miro"
143-
"monarch"
144-
"notion"
145-
"notion-calendar"
146-
"ngrok"
147-
"orion"
148-
"onyx"
149-
"orbstack"
150-
"pgadmin4"
151-
"postman"
152-
"raycast"
153-
"reactotron"
154-
"rectangle-pro"
155-
"setapp"
156-
"signal"
157-
"slack"
158-
"sloth"
159-
"spotify"
160-
"ssh-config-editor"
161-
"syncthing-app"
162-
"the-unarchiver"
163-
"tidal"
164-
"tower"
165-
"transmission"
166-
"visual-studio-code"
167-
"vlc"
168-
"wifiman"
169-
"xrg"
170-
"zed"
171-
"zoom"
172-
];
173-
taps = [
174-
"azure/functions"
175-
"homebrew/test-bot"
176-
"sst/tap"
177-
"FelixKratz/formulae"
178-
];
179-
masApps = {
180-
"DaisyDisk" = 411643860;
181-
"Hyperspace" = 6739505345;
182-
"Ice Cubes" = 6444915884;
183-
"Ivory" = 6444602274;
184-
"Keka" = 470158793;
185-
"MediaInfo" = 510620098;
186-
"Okta Verify" = 490179405;
187-
"Parcel" = 639968404;
188-
"Photomator" = 1444636541;
189-
"Pixelmator Pro" = 1289583905;
190-
"Prime Video" = 545519333;
191-
"Raw Convertor" = 1598580439;
192-
"Screens 5" = 1663047912;
193-
"Tailscale" = 1475387142;
194-
"WireGuard" = 1451685025;
195-
"Xcode" = 497799835;
196-
};
197-
};
198-
199-
system.defaults = {
200-
NSGlobalDomain = {
201-
AppleInterfaceStyle = "Dark";
202-
NSWindowShouldDragOnGesture = true;
203-
NSAutomaticSpellingCorrectionEnabled = false;
204-
NSAutomaticQuoteSubstitutionEnabled = false;
205-
NSAutomaticDashSubstitutionEnabled = false;
206-
NSAutomaticCapitalizationEnabled = false;
207-
InitialKeyRepeat = 20;
208-
KeyRepeat = 1;
209-
AppleShowAllExtensions = true;
210-
"com.apple.springing.enabled" = true;
211-
"com.apple.springing.delay" = 0.1;
212-
"com.apple.swipescrolldirection" = false;
213-
};
214-
215-
screencapture = {
216-
location = "~/Downloads";
217-
type = "png";
218-
disable-shadow = true;
219-
};
220-
221-
finder = {
222-
CreateDesktop = false;
223-
QuitMenuItem = true;
224-
_FXShowPosixPathInTitle = true;
225-
FXEnableExtensionChangeWarning = false;
226-
FXPreferredViewStyle = "Nlsv";
227-
ShowExternalHardDrivesOnDesktop = false;
228-
ShowHardDrivesOnDesktop = false;
229-
ShowMountedServersOnDesktop = false;
230-
ShowRemovableMediaOnDesktop = false;
231-
ShowStatusBar = true;
232-
# Current Folder
233-
FXDefaultSearchScope = "SCcf";
234-
NewWindowTarget = "Other";
235-
NewWindowTargetPath = "file://${builtins.getEnv "HOME"}";
236-
};
237-
238-
dock = {
239-
autohide = true;
240-
show-recents = false;
241-
expose-animation-duration = 0.15;
242-
orientation = "left";
243-
tilesize = 32;
244-
magnification = true;
245-
largesize = 64;
246-
};
247-
248-
ActivityMonitor = {
249-
OpenMainWindow = true;
250-
# All Processes
251-
ShowCategory = 100;
252-
SortColumn = "CPUUsage";
253-
# Descending
254-
SortDirection = 0;
255-
};
256-
257-
CustomUserPreferences = {
258-
"com.apple.desktopservices" = {
259-
# Avoid creating .DS_Store files on network or USB volumes
260-
DSDontWriteNetworkStores = true;
261-
DSDontWriteUSBStores = true;
262-
};
263-
"com.apple.TimeMachine".DoNotOfferNewDisksForBackup = true;
264-
# Prevent Photos from opening automatically when devices are plugged in
265-
"com.apple.ImageCapture".disableHotPlug = true;
266-
# Turn on app auto-update
267-
"com.apple.commerce".AutoUpdate = true;
268-
};
269-
};
270-
271-
# Disable skhd for now
272-
# services.skhd = {
273-
# enable = true;
274-
# skhdConfig = ''
275-
# cmd - return : open --new -a ghostty.app
276-
# '';
277-
# };
278-
279-
system.activationScripts.extraActivation.text = ''
280-
# Show Library folder
281-
chflags nohidden ~/Library
282-
283-
# TODO: Disable until I can determine why this inverts natural scrolling option
284-
# Following line should allow us to avoid a logout/login cycle to see changes
285-
# /System/Library/PrivateFrameworks/SystemAdministration.framework/Resources/activateSettings -u
286-
'';
28717
}

darwin/gaming.nix

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
{ ... }:
1+
{ lib, config, ... }:
22

3-
{
3+
lib.mkIf config.profiles.gaming.enable {
44
homebrew = {
55
casks = [
66
"crossover"

darwin/hosts/benson.nix

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{ ... }:
2+
3+
{
4+
profiles = {
5+
audio.enable = true;
6+
gaming.enable = true;
7+
photography.enable = true;
8+
video.enable = true;
9+
};
10+
}

0 commit comments

Comments
 (0)