-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
207 lines (188 loc) · 5.5 KB
/
flake.nix
File metadata and controls
207 lines (188 loc) · 5.5 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
{
description = "darwin config";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
nix-darwin.url = "github:LnL7/nix-darwin";
nix-darwin.inputs.nixpkgs.follows = "nixpkgs";
nix-homebrew.url = "github:zhaofengli-wip/nix-homebrew";
homebrew-core = {
url = "github:homebrew/homebrew-core";
flake = false;
};
homebrew-cask = {
url = "github:homebrew/homebrew-cask";
flake = false;
};
homebrew-bundle = {
url = "github:homebrew/homebrew-bundle";
flake = false;
};
home-manager.url = "github:nix-community/home-manager";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = inputs@{ self, nix-darwin, nixpkgs, nix-homebrew, homebrew-core, homebrew-cask, homebrew-bundle, home-manager }:
let
configuration = { pkgs, config, ... }: {
nixpkgs.config.allowUnfree = true;
environment.systemPackages =
[
# tooling
pkgs.kubectl
pkgs.kubectx
pkgs.fluxcd
pkgs.kind
pkgs.sops
pkgs.tmux
pkgs.opentofu
pkgs.hcloud
pkgs.pre-commit
pkgs.tree
pkgs.jq
pkgs.bore-cli
pkgs.git
pkgs.neovim
pkgs.buf
pkgs.direnv
pkgs.age
pkgs.mtr
pkgs.gnupg
pkgs.yubikey-manager
pkgs.yubico-pam
pkgs.yubikey-personalization
pkgs.protobuf
pkgs.buf
pkgs.tmate
pkgs.colima
pkgs.docker
pkgs.golangci-lint
pkgs.ffmpeg
pkgs.dbmate
pkgs.sqlc
pkgs.postgresql
pkgs.scdl
pkgs.k9s
pkgs.packer
pkgs.minio-client
pkgs.yq
pkgs.grpcurl
pkgs.luajitPackages.luarocks
pkgs.gradle
pkgs.aptly
pkgs.awscli2
pkgs.maven
# langs
pkgs.go_1_26
pkgs.luajit
# gui apps
pkgs.jetbrains-toolbox
pkgs.alacritty
pkgs.wireshark
pkgs.obsidian
pkgs.utm
# misc
pkgs.mkalias
pkgs.oh-my-zsh
# audio
pkgs.blackhole
];
homebrew = {
enable = true;
# remove all packages that have
# not been installed using nix
onActivation.cleanup = "zap";
brews = [
"lima"
"wget"
"curl"
"mas"
"fzf"
"zoxide"
"openjdk@21"
"openssl@3"
];
casks = [
"google-chrome"
"bitwarden"
"discord"
"zed"
"postico"
"headlamp"
];
masApps = {
#"Magnet" = 441258766;
#"Tailscale" = 1475387142;
};
};
system.primaryUser = "yannic";
system.defaults.NSGlobalDomain."com.apple.swipescrolldirection" = false;
system.defaults.dock.mineffect = "scale";
users.users.yannic = {
name = "yannic";
home = "/Users/yannic";
};
system.activationScripts.applications.text = let
env = pkgs.buildEnv {
name = "system-applications";
paths = config.environment.systemPackages;
pathsToLink = ["/Applications"];
};
in
pkgs.lib.mkForce ''
# Set up applications.
echo "setting up /Applications..." >&2
rm -rf /Applications/Nix\ Apps
mkdir -p /Applications/Nix\ Apps
find ${env}/Applications -maxdepth 1 -type l -exec readlink '{}' + |
while read -r src; do
app_name=$(basename "$src")
echo "copying $src" >&2
${pkgs.mkalias}/bin/mkalias "$src" "/Applications/Nix Apps/$app_name"
done
'';
# Necessary for using flakes on this system.
nix.settings.experimental-features = "nix-command flakes";
programs.zsh.enable = true;
# Set Git commit hash for darwin-version.
system.configurationRevision = self.rev or self.dirtyRev or null;
# Used for backwards compatibility, please read the changelog before changing.
# $ darwin-rebuild changelog
system.stateVersion = 5;
# The platform the configuration will be used on.
nixpkgs.hostPlatform = "aarch64-darwin";
};
in
{
darwinConfigurations."personal" = nix-darwin.lib.darwinSystem {
modules = [
configuration
home-manager.darwinModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.yannic = import ./home.nix;
}
nix-homebrew.darwinModules.nix-homebrew
{
nix-homebrew = {
# Install Homebrew under the default prefix
enable = true;
# Apple Silicon Only: Also install Homebrew under the default Intel prefix for Rosetta 2
enableRosetta = true;
# User owning the Homebrew prefix
user = "yannic";
# Optional: Declarative tap management
taps = {
"homebrew/homebrew-core" = homebrew-core;
"homebrew/homebrew-cask" = homebrew-cask;
"homebrew/homebrew-bundle" = homebrew-bundle;
};
# Optional: Enable fully-declarative tap management
#
# With mutableTaps disabled, taps can no longer be added imperatively with `brew tap`.
mutableTaps = false;
};
}
];
};
};
}