-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
349 lines (307 loc) · 10.4 KB
/
flake.nix
File metadata and controls
349 lines (307 loc) · 10.4 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
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
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
{
description = "Modular configuration of Home Manager and NixOS with Denix";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
zen-browser = {
url = "github:0xc000022070/zen-browser-flake";
inputs.nixpkgs.follows = "nixpkgs";
inputs.home-manager.follows = "home-manager";
};
firefox-addons = {
url = "github:connerohnesorge/nur-expressions?dir=pkgs/firefox-addons";
inputs.nixpkgs.follows = "nixpkgs";
};
proton-authenticator.url = "github:connerohnesorge/proton-authenticator-flake?ref=0494e1b70724861b4f8e2fb314b744e0591dfbb5";
proton-authenticator.inputs.nixpkgs.follows = "nixpkgs";
spectr.url = "github:connerohnesorge/spectr/add-multi-repo-discovery";
spectr.inputs.nixpkgs.follows = "nixpkgs";
ovim.url = "github:connerohnesorge/ovim?ref=2cad976dc4b5b7ae59726053d2b0b67b2b655ec2";
ovim.inputs.nixpkgs.follows = "nixpkgs";
constatus = {
url = "github:connerohnesorge/constatus";
inputs.nixpkgs.follows = "nixpkgs";
inputs.crane.follows = "crane";
};
conclaude = {
url = "github:connerohnesorge/conclaude";
inputs.nixpkgs.follows = "nixpkgs";
inputs.crane.follows = "crane";
};
nix-ai-tools = {
url = "github:numtide/llm-agents.nix";
inputs.nixpkgs.follows = "nixpkgs";
inputs.treefmt-nix.follows = "treefmt-nix";
};
kiro-flake = {
url = "github:connerohnesorge/kiro-flake";
inputs.nixpkgs.follows = "nixpkgs";
};
nordvpn.url = "github:connerohnesorge/nordvpn-flake";
nordvpn.inputs.nixpkgs.follows = "nixpkgs";
nix-darwin.url = "github:nix-darwin/nix-darwin/master";
nix-darwin.inputs.nixpkgs.follows = "nixpkgs";
home-manager = {
url = "github:nix-community/home-manager/master";
inputs.nixpkgs.follows = "nixpkgs";
};
nixos-wsl.url = "github:nix-community/NixOS-WSL/main";
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
flake-utils.url = "github:numtide/flake-utils";
systems.url = "github:nix-systems/default";
determinate.url = "https://flakehub.com/f/DeterminateSystems/determinate/*";
denix = {
url = "github:yunfachi/denix";
inputs = {
nixpkgs.follows = "nixpkgs";
home-manager.follows = "home-manager";
nix-darwin.follows = "nix-darwin";
};
};
hyprland.url = "github:hyprwm/hyprland";
hyprland.inputs.nixpkgs.follows = "nixpkgs";
nix-ld.url = "github:Mic92/nix-ld";
nix-ld.inputs.nixpkgs.follows = "nixpkgs";
stylix.url = "https://flakehub.com/f/danth/stylix/0.1.776";
stylix.inputs = {
nixpkgs.follows = "nixpkgs";
systems.follows = "systems";
};
ghostty.url = "github:ghostty-org/ghostty/main";
ghostty.inputs = {
nixpkgs.follows = "nixpkgs";
flake-utils.follows = "flake-utils";
};
blink.url = "github:Saghen/blink.cmp";
blink.inputs.nixpkgs.follows = "nixpkgs";
fff = {
url = "github:dmtrKovalenko/fff.nvim";
inputs = {
nixpkgs.follows = "nixpkgs";
flake-utils.follows = "flake-utils";
crane.follows = "crane";
};
};
crane.url = "github:ipetkov/crane";
nix-index-database.url = "github:nix-community/nix-index-database";
nix-index-database.inputs.nixpkgs.follows = "nixpkgs";
sops = {
url = "github:Mic92/sops-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
disko = {
url = "github:nix-community/disko";
inputs.nixpkgs.follows = "nixpkgs";
};
treefmt-nix.url = "github:numtide/treefmt-nix";
treefmt-nix.inputs.nixpkgs.follows = "nixpkgs";
nix-auth.url = "github:numtide/nix-auth";
nix-auth.inputs.nixpkgs.follows = "nixpkgs";
nix-version-search = {
url = "github:jeff-hykin/nix_version_search_cli";
inputs.nixpkgs.follows = "nixpkgs";
};
flake-parts = {
url = "github:hercules-ci/flake-parts";
};
# Used for shell.nix
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
};
outputs = inputs @ {
denix,
flake-parts,
...
}:
flake-parts.lib.mkFlake {inherit inputs;} {
systems = [
"x86_64-linux"
"x86_64-darwin"
"aarch64-linux"
"aarch64-darwin"
];
imports = [];
flake = let
mkConfigurations = moduleSystem:
denix.lib.configurations {
# homeManagerUser is set dynamically per-host via myconfig.host.username
# See modules/config/constants.nix and modules/config/home.nix
inherit moduleSystem;
paths = [./hosts ./modules ./rices];
specialArgs = {
inherit inputs;
};
};
in {
nixosConfigurations = mkConfigurations "nixos";
# homeConfigurations = mkConfigurations "home";
darwinConfigurations = mkConfigurations "darwin";
templates = {
devshell = {
description = "A devshell for developing with nix.";
path = ./templates/devshell;
};
go-shell = {
description = "A go shell for developing with nix.";
path = ./templates/go-shell;
};
templ-shell = {
description = "A go + templ shell for developing with nix.";
path = ./templates/templ-shell;
};
rust-shell = {
description = "A rust shell for developing with nix.";
path = ./templates/rust-shell;
};
askama-shell = {
description = "A rust web shell for developing with nix and askama.";
path = ./templates/askama-shell;
};
typescript-shell = {
description = "A TypeScript shell with modern tooling (ESLint, oxlint, Biome, LSPs).";
path = ./templates/typescript-shell;
};
remix-shell = {
description = "A Remix JS shell for developing with bun.";
path = ./templates/remix-shell;
};
phoenix-shell = {
description = "An Elixir Phoenix Framework shell for developing with nix.";
path = ./templates/phoenix-shell;
};
laravel-shell = {
description = "A Laravel shell for developing with nix.";
path = ./templates/laravel-shell;
};
lua-shell = {
description = "A lua shell for developing with nix.";
path = ./templates/lua-shell;
};
ocaml-shell = {
description = "An OCaml shell with modern tooling and best practices.";
path = ./templates/ocaml-shell;
};
python-shell = {
description = "A Python shell with modern tooling (basedpyright, ruff, black, pytest).";
path = ./templates/python-shell;
};
cpp-shell = {
description = "A C++ shell with modern tooling (GCC, Clang, CMake, static analysis).";
path = ./templates/cpp-shell;
};
csharp-shell = {
description = "A C# development shell with .NET 8 SDK and buildDotnetModule support.";
path = ./templates/csharp-shell;
};
cuda-shell = {
description = "A cuda shell for developing with nix.";
path = ./templates/cuda-shell;
};
zig-shell = {
description = "A zig shell for developing with nix.";
path = ./templates/zig-shell;
};
starlight-shell = {
description = "A astro starlight docs site shell/project for developing with nix.";
path = ./templates/starlight-shell;
};
latex-shell = {
description = "A LaTeX development shell with Overleaf-equivalent features.";
path = ./templates/latex-shell;
};
};
};
perSystem = {
# config,
# self',
# inputs',
pkgs,
# system,
...
}: let
scripts = {
dx = {
exec = ''$EDITOR "$REPO_ROOT"/flake.nix'';
description = "Edit the flake.nix";
deps = [];
};
lint = {
exec = ''
REPO_ROOT="$(git rev-parse --show-toplevel)"
statix check "$REPO_ROOT"/flake.nix
deadnix "$REPO_ROOT"/flake.nix
find . -name "go.mod" -type f | while read -r modfile; do
DIR=$(dirname "$modfile")
echo "Linting: $DIR"
(cd "$DIR" && golangci-lint run ./...) || echo "Go linting completed with warnings"
done
nix flake check "$REPO_ROOT"
'';
deps = with pkgs; [git statix deadnix golangci-lint];
description = "Run linting tools (statix, deadnix, nix flake check)";
};
};
scriptPackages =
pkgs.lib.mapAttrs
(
name: script:
pkgs.writeShellApplication {
inherit name;
text = script.exec;
runtimeInputs = script.deps or [];
}
)
scripts;
treefmtModule = {
projectRootFile = "flake.nix";
programs = {
alejandra.enable = true; # Nix formatter
rustfmt.enable = true; # Rust formatter
black.enable = true; # Python formatter
};
};
in {
devShells.default = pkgs.mkShell {
shellHook = ''
export REPO_ROOT="$(git rev-parse --show-toplevel)"
export CGO_CFLAGS="-O2"
'';
packages = with pkgs;
[
alejandra # Nix
nixd
gum # Terminal UI toolkit
xmlstarlet
xml2
ruff # Python
black
isort
basedpyright
luajitPackages.luacheck
biome
oxlint
pyrefly
poppler
sqlite
go
air
golangci-lint
gopls
revive
templ
golines
golangci-lint-langserver
gomarkdoc
gotests
gotools
reftools
geesefs
sops
]
++ builtins.attrValues scriptPackages;
};
formatter = inputs.treefmt-nix.lib.mkWrapper pkgs treefmtModule;
};
};
}