-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
270 lines (232 loc) · 8.49 KB
/
flake.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
####
## nix build .#darwinConfigurations.mkDarwin.system
## ./result/sw/bin/darwin-rebuild switch --flake ~/Projects/dotfiles#mkDarwin
## darwin-rebuild switch --flake .#mkDarwin
####
{
description = "root & home-manager nix flake";
inputs = {
# nixpkgs url
nixpkgs.url = "github:nixos/nixpkgs/release-24.05";
# nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixpkgs-unstable";
# links configs to home directory
home-manager = {
url = "github:nix-community/home-manager/release-24.05";
inputs.nixpkgs.follows = "nixpkgs";
};
# system level settings; softwares
darwin = {
url = "github:lnl7/nix-darwin/master";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = inputs: {
formatter.aarch64-darwin = inputs.nixpkgs.legacyPackages.aarch64-darwin.alejandra;
darwinConfigurations = {
mkDarwin = inputs.darwin.lib.darwinSystem {
system = "aarch64-darwin";
pkgs = import inputs.nixpkgs {
system = "aarch64-darwin";
config.allowUnfree = true;
};
modules = [
({pkgs, ...}: {
# darwin configs
programs.fish.enable = true;
environment.shells = [pkgs.bash pkgs.fish];
environment.loginShell = pkgs.fish;
environment.systemPackages = with pkgs; [
coreutils
rustup
bacon
ripgrep
tailscale
ansible
pipx # python pkg
uv # python package manager
sniffnet # internet observability
nghttp2 # http2 tool
## running containers on apple silicon
# colima
# docker-client
##
fd
curl
less
neofetch
htop
gh
lazygit
riffdiff # better diff
gfold # git repo management
oxker # docker tui
tealdeer # fast tldr
alejandra # nix formatter
xh
ripsecrets
atuin
k6 # load testing tool
lld_16 # fast apple linker
glow # markdown reader
mods # charm ai llm
# k9s # cli k8s ide
# kubectl
# utm
protobuf
grpcui
grpcurl
mise # rtx
discord
vscode
raycast
];
services.tailscale.enable = true;
system.stateVersion = 5; # don't know why, but it fixes build
system.keyboard.enableKeyMapping = true;
system.keyboard.remapCapsLockToEscape = true;
system.defaults.dock.autohide = true;
system.defaults.NSGlobalDomain.InitialKeyRepeat = 14;
system.defaults.NSGlobalDomain.KeyRepeat = 1;
# Auto upgrade nix package and the daemon service.
services.nix-daemon.enable = true;
# extra nix configs
nix.settings.auto-optimise-store = true;
nix.extraOptions = ''
auto-optimise-store = true
experimental-features = nix-command flakes
'';
})
inputs.home-manager.darwinModules.home-manager
{
users.users.hanz.home = "/Users/hanz";
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
users.hanz.imports = [
({pkgs, ...}: {
home.username = "hanz";
home.homeDirectory = pkgs.lib.mkDefault "/Users/hanz";
### Don't change this when you change package input. Leave it alone. ###
home.stateVersion = "23.05";
### --- ###
home.packages = with pkgs; [
## mac desktop specific apps
qbittorrent
mpv-unwrapped
iina # video player for macOS
# inputs.nixpkgs-unstable.legacyPackages.aarch64-darwin.calibre
# calibre
# amethyst # -- not available on nix, use homebrew instead
];
home.sessionVariables = {
PAGER = "less";
CLICLOLOR = 1;
EDITOR = "nvim";
ZELLIJ_AUTO_EXIT = "true";
};
# programs to install
# programs.rtx = {
# enable = true;
# enableFishIntegration = true;
# };
programs.neovim = {
enable = true;
viAlias = true;
vimAlias = true;
# extraPackages = with pkgs; [gcc];
};
programs.zoxide = {
enable = true; # smarter 'cd'
enableFishIntegration = true;
};
programs.bat.enable = true;
programs.fzf.enable = true;
programs.fzf.enableFishIntegration = true;
programs.lsd.enable = true;
programs.lsd.enableAliases = true;
programs.fish = {
enable = true;
shellAliases = {
# cd = "z";
zj = "zellij";
lg = "lazygit";
gs = "git status -s";
cat = "bat";
n = "nvim";
vim = "nvim";
rtx = "mise";
};
shellInit = ''
mise activate fish | source
atuin init fish | source
eval "$(/opt/homebrew/bin/brew shellenv)"
'';
};
programs.starship = let
flavour = "mocha"; # One of `latte`, `frappe`, `macchiato`, or `mocha`
in {
enable = true;
enableFishIntegration = true;
settings =
{
# Other config here
format = "$all"; # Remove this line to disable the default prompt format
palette = "catppuccin_${flavour}";
}
// builtins.fromTOML (builtins.readFile
(pkgs.fetchFromGitHub
{
owner = "catppuccin";
repo = "starship";
rev = "3e3e54410c3189053f4da7a7043261361a1ed1bc"; # Replace with the latest commit hash
sha256 = "sha256-soEBVlq3ULeiZFAdQYMRFuswIIhI9bclIU8WXjxd7oY=";
}
+ /palettes/${flavour}.toml));
};
# Let Home Manager install and manage itself.
programs.home-manager.enable = true;
# configure git
programs.git = {
enable = true;
userName = "Hanz";
userEmail = "[email protected]";
ignores = [
".direnv"
];
extraConfig = {
pull.rebase = true;
init.defaultBranch = "main";
github.user = "fivehanz";
};
};
programs.wezterm = {
enable = true;
extraConfig = ''
return {
color_scheme = 'tokyonight',
window_background_opacity = 0.90,
macos_window_background_blur = 20,
}
'';
};
programs.zellij = {
enable = true;
# enableFishIntegration = true;
settings = {
simplified_ui = true;
};
};
programs.direnv = {
enable = true;
nix-direnv.enable = true;
};
})
];
};
}
];
};
};
};
}