Repository navigation
Expand file tree
/
Copy pathflake.nix
More file actions
774 lines (706 loc) · 27.8 KB
/
Copy pathflake.nix
File metadata and controls
774 lines (706 loc) · 27.8 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
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
{
description = "nxv - Nix Version Index";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
devshell = {
url = "github:numtide/devshell";
inputs.nixpkgs.follows = "nixpkgs";
};
treefmt-nix = {
url = "github:numtide/treefmt-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
crane.url = "github:ipetkov/crane";
};
outputs =
inputs:
inputs.flake-parts.lib.mkFlake { inherit inputs; } {
imports = [
inputs.devshell.flakeModule
inputs.treefmt-nix.flakeModule
];
systems = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
flake = {
# Overlay for use in NixOS/home-manager configs
overlays.default = final: prev: {
nxv = inputs.self.packages.${prev.system}.nxv;
nxv-indexer = inputs.self.packages.${prev.system}.nxv-indexer;
};
# NixOS module for running nxv as a service
nixosModules.default = import ./nix/module.nix {
flakePackages = inputs.self.packages;
};
nixosModules.nxv = inputs.self.nixosModules.default;
};
perSystem =
{
system,
lib,
...
}:
let
pkgs = import inputs.nixpkgs {
localSystem = system;
overlays = [ inputs.rust-overlay.overlays.default ];
};
# Derive a stable Docker image timestamp from the flake's lastModifiedDate.
# Format: 20260108123456 -> 2026-01-08T12:34:56Z
lastModified = toString (inputs.self.lastModifiedDate or "19700101000000");
dockerTimestamp =
"${builtins.substring 0 4 lastModified}-${builtins.substring 4 2 lastModified}-${
builtins.substring 6 2 lastModified
}"
+ "T${builtins.substring 8 2 lastModified}:${builtins.substring 10 2 lastModified}:${
builtins.substring 12 2 lastModified
}Z";
rustToolchain = pkgs.rust-bin.stable.latest.default.override {
extensions = [
"rust-src"
"rust-analyzer"
"rustfmt"
"clippy"
];
};
craneLib = (inputs.crane.mkLib pkgs).overrideToolchain rustToolchain;
# Source filter: include Cargo sources plus specific frontend assets
# (CSS, fonts, HTML, JS - but not node_modules or build output).
# The generated CSS, fonts, and Tailwind source CSS are included so
# `nix build` can produce a fully offline binary (no CDN needed).
src = lib.cleanSourceWith {
src = ./.;
filter =
path: type:
let
# cleanSourceWith filters per-path, including directories.
# We must let the `frontend/` and `frontend/fonts/` directories
# through so the asset files inside them survive filtering.
isFrontendDir =
type == "directory"
&& (
(builtins.match ".*/frontend$" path) != null
|| (builtins.match ".*/frontend/fonts$" path) != null
|| (builtins.match ".*/keys$" path) != null
);
# The agent-skill template is embedded via include_str! and
# must survive the Cargo source filter.
isSkillTemplate = (builtins.match ".*/src/skill/SKILL\.md$" path) != null;
isFrontendAsset =
type == "regular"
&& (
(builtins.match ".*frontend/(index\.html|app\.js|favicon\.svg|package\.json|package-lock\.json)$" path)
!= null
|| (builtins.match ".*frontend/(tailwind\.(src|generated)\.css|fonts\.css)$" path) != null
|| (builtins.match ".*frontend/fonts/.*\.(woff2|ttf)$" path) != null
);
isKey = (builtins.match ".*keys/.*\.pub$" path) != null;
notNodeModules = (builtins.match ".*/node_modules/.*" path) == null;
in
(craneLib.filterCargoSources path type)
|| isFrontendDir
|| isSkillTemplate
|| (isKey && notNodeModules)
|| (isFrontendAsset && notNodeModules);
};
crateInfo = craneLib.crateNameFromCargoToml { cargoToml = ./Cargo.toml; };
# Git revision for version string (available when flake is in a git repo)
gitRev = inputs.self.shortRev or inputs.self.dirtyShortRev or "";
commonArgs = {
inherit src;
inherit (crateInfo) pname version;
strictDeps = true;
NXV_GIT_REV = gitRev;
buildInputs = [
pkgs.openssl
]
++ lib.optionals pkgs.stdenv.isDarwin [
pkgs.libiconv
];
nativeBuildInputs = [
pkgs.pkg-config
pkgs.installShellFiles
];
}
// lib.optionalAttrs pkgs.stdenv.isDarwin {
# Xcode clang needs an explicit path to Nix-provided libiconv;
# build scripts and the final link both look it up via -liconv.
LIBRARY_PATH = "${pkgs.libiconv}/lib";
NIX_LDFLAGS = "-L${pkgs.libiconv}/lib";
};
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
installCompletions = ''
installShellCompletion --cmd nxv \
--bash <($out/bin/nxv completions bash) \
--zsh <($out/bin/nxv completions zsh) \
--fish <($out/bin/nxv completions fish)
'';
nxv = craneLib.buildPackage (
commonArgs
// {
inherit cargoArtifacts;
postInstall = installCompletions;
meta = {
description = "Nix Version Index";
homepage = "https://github.com/utensils/nxv";
license = lib.licenses.mit;
maintainers = [ ];
mainProgram = "nxv";
};
}
);
nxv-indexer = craneLib.buildPackage (
commonArgs
// {
inherit cargoArtifacts;
cargoExtraArgs = "--features indexer";
pname = "nxv-indexer";
buildInputs = commonArgs.buildInputs ++ [ pkgs.libgit2 ];
nativeBuildInputs = commonArgs.nativeBuildInputs ++ [
pkgs.cmake
pkgs.git
];
postInstall = installCompletions;
meta = {
description = "Nix Version Index (with indexer feature)";
homepage = "https://github.com/utensils/nxv";
license = lib.licenses.mit;
maintainers = [ ];
mainProgram = "nxv";
};
}
);
# Static musl build (Linux only). Uses cross-compilation so build
# scripts don't crash inside the sandbox.
nxv-static =
let
isLinux = pkgs.stdenv.isLinux;
target =
if system == "aarch64-linux" then "aarch64-unknown-linux-musl" else "x86_64-unknown-linux-musl";
pkgsMusl =
if system == "aarch64-linux" then
pkgs.pkgsCross.aarch64-multiplatform-musl
else
pkgs.pkgsCross.musl64;
muslCC = "${pkgsMusl.stdenv.cc}/bin/${pkgsMusl.stdenv.cc.targetPrefix}cc";
rustToolchainMusl = pkgs.rust-bin.stable.latest.default.override {
targets = [ target ];
};
craneLibMusl = (inputs.crane.mkLib pkgs).overrideToolchain rustToolchainMusl;
muslBuildArgs = {
inherit src;
inherit (crateInfo) pname version;
strictDeps = true;
NXV_GIT_REV = gitRev;
CARGO_BUILD_TARGET = target;
CARGO_BUILD_RUSTFLAGS = "-C target-feature=+crt-static -C linker=${muslCC}";
HOST_CC = "${pkgs.stdenv.cc}/bin/cc";
TARGET_CC = muslCC;
CC_x86_64_unknown_linux_musl = muslCC;
CC_aarch64_unknown_linux_musl = muslCC;
hardeningDisable = [ "fortify" ];
nativeBuildInputs = [
pkgs.pkg-config
pkgsMusl.stdenv.cc
];
buildInputs = [ ];
};
cargoArtifactsMusl = craneLibMusl.buildDepsOnly muslBuildArgs;
in
if isLinux then
craneLibMusl.buildPackage (
muslBuildArgs
// {
pname = "nxv-static";
cargoArtifacts = cargoArtifactsMusl;
nativeBuildInputs = muslBuildArgs.nativeBuildInputs ++ [ pkgs.installShellFiles ];
postInstall = installCompletions;
meta = {
description = "Nix Version Index (static musl binary)";
homepage = "https://github.com/utensils/nxv";
license = lib.licenses.mit;
maintainers = [ ];
mainProgram = "nxv";
platforms = [
"x86_64-linux"
"aarch64-linux"
];
};
}
)
else
pkgs.runCommand "nxv-static-unavailable" { } ''
echo "nxv-static is only available on Linux" >&2
exit 1
'';
# Cross-compile nxv to aarch64-linux-musl from x86_64-linux.
nxv-static-aarch64 =
let
isLinuxX86 = pkgs.stdenv.isLinux && system == "x86_64-linux";
target = "aarch64-unknown-linux-musl";
pkgsMusl = pkgs.pkgsCross.aarch64-multiplatform-musl;
muslCC = "${pkgsMusl.stdenv.cc}/bin/${pkgsMusl.stdenv.cc.targetPrefix}cc";
rustToolchainMusl = pkgs.rust-bin.stable.latest.default.override {
targets = [ target ];
};
craneLibMusl = (inputs.crane.mkLib pkgs).overrideToolchain rustToolchainMusl;
muslBuildArgs = {
inherit src;
inherit (crateInfo) pname version;
strictDeps = true;
NXV_GIT_REV = gitRev;
CARGO_BUILD_TARGET = target;
CARGO_BUILD_RUSTFLAGS = "-C target-feature=+crt-static -C linker=${muslCC}";
HOST_CC = "${pkgs.stdenv.cc}/bin/cc";
TARGET_CC = muslCC;
CC_aarch64_unknown_linux_musl = muslCC;
hardeningDisable = [ "fortify" ];
nativeBuildInputs = [
pkgs.pkg-config
pkgsMusl.stdenv.cc
];
buildInputs = [ ];
};
cargoArtifactsMusl = craneLibMusl.buildDepsOnly muslBuildArgs;
in
if isLinuxX86 then
craneLibMusl.buildPackage (
muslBuildArgs
// {
pname = "nxv-static-aarch64";
cargoArtifacts = cargoArtifactsMusl;
# Skip tests — can't run aarch64 binary on x86_64 without QEMU.
doCheck = false;
nativeBuildInputs = muslBuildArgs.nativeBuildInputs ++ [ pkgs.installShellFiles ];
# Skip shell completions — can't run aarch64 binary on x86_64.
postInstall = "";
meta = {
description = "Nix Version Index (static aarch64 musl binary)";
homepage = "https://github.com/utensils/nxv";
license = lib.licenses.mit;
maintainers = [ ];
mainProgram = "nxv";
platforms = [ "x86_64-linux" ];
};
}
)
else
pkgs.runCommand "nxv-static-aarch64-unavailable" { } ''
echo "nxv-static-aarch64 cross-compilation is only available on x86_64-linux" >&2
exit 1
'';
nxv-docker =
if pkgs.stdenv.isLinux then
pkgs.dockerTools.buildLayeredImage {
name = "nxv";
tag = crateInfo.version;
created = dockerTimestamp;
contents = [
nxv-indexer
pkgs.cacert
pkgs.tzdata
pkgs.git
];
config = {
Entrypoint = [ "${nxv-indexer}/bin/nxv" ];
Cmd = [ "serve" ];
ExposedPorts = {
"8080/tcp" = { };
};
Env = [
"SSL_CERT_FILE=${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt"
"TZ=UTC"
];
Labels = {
"org.opencontainers.image.title" = "nxv";
"org.opencontainers.image.description" = "Nix Version Index - search nixpkgs package history";
"org.opencontainers.image.source" = "https://github.com/utensils/nxv";
"org.opencontainers.image.version" = crateInfo.version;
};
};
}
else
pkgs.runCommand "nxv-docker-unavailable" { } ''
echo "Docker images are only available on Linux" >&2
exit 1
'';
in
{
_module.args.pkgs = pkgs;
packages = {
inherit
nxv
nxv-indexer
nxv-static
nxv-static-aarch64
nxv-docker
;
default = nxv;
};
apps = {
default = {
type = "app";
program = "${nxv}/bin/nxv";
meta = nxv.meta;
};
nxv = {
type = "app";
program = "${nxv}/bin/nxv";
meta = nxv.meta;
};
nxv-indexer = {
type = "app";
program = "${nxv-indexer}/bin/nxv";
meta = nxv-indexer.meta;
};
};
checks = {
inherit nxv;
# The indexer build runs its test suite inside the Nix sandbox
# (read-only HOME, loopback-only network) — an environment no
# other check exercises. Without this, sandbox-only failures
# surface first in the main-branch Docker image build.
inherit nxv-indexer;
nxv-clippy = craneLib.cargoClippy (
commonArgs
// {
inherit cargoArtifacts;
cargoClippyExtraArgs = "--all-targets -- --deny warnings";
}
);
nxv-test = craneLib.cargoTest (
commonArgs
// {
inherit cargoArtifacts;
}
);
nxv-fmt = craneLib.cargoFmt { inherit src; };
# Static accessibility audit: html5 validity + custom WCAG script.
# Runs fully offline, so safe for `nix flake check` / CI.
nxv-a11y =
let
pythonWithDeps = pkgs.python3.withPackages (ps: [
ps.beautifulsoup4
ps.wcag-contrast-ratio
]);
in
pkgs.runCommand "nxv-a11y"
{
nativeBuildInputs = [
pkgs.html5validator
pythonWithDeps
];
}
''
cp -r ${./frontend} frontend
cp ${./scripts/a11y_check.py} a11y_check.py
html5validator --root frontend --match "*.html" \
--ignore 'error: CSS:' \
'The only allowed value for the "type" attribute for the "style" element'
python3 a11y_check.py frontend/index.html
touch $out
'';
};
devshells.default = {
motd = ''
{202}nxv{reset} — Nix Version Index ({bold}${system}{reset})
$(type menu &>/dev/null && menu)
'';
packagesFrom = [ nxv ];
packages = [
rustToolchain
pkgs.cargo-watch
pkgs.cargo-edit
pkgs.cargo-outdated
pkgs.cargo-audit
pkgs.cargo-llvm-cov
pkgs.git
pkgs.gh
pkgs.jq
pkgs.miniserve # Simple HTTP server for frontend dev
pkgs.prettier # HTML/JS/CSS formatter
pkgs.markdownlint-cli # Markdown linter
pkgs.k6 # Load testing tool
# Accessibility tooling — static checks run offline, the dynamic
# pa11y-ci check uses `npx` which fetches from npm on first run.
pkgs.html5validator
(pkgs.python3.withPackages (ps: [
ps.beautifulsoup4
ps.wcag-contrast-ratio
]))
pkgs.nodejs_22 # Node.js for Tailwind CSS v4 CLI
pkgs.bun # VitePress docs site runtime
];
env = [
{
name = "RUST_BACKTRACE";
value = "1";
}
]
++ lib.optionals pkgs.stdenv.isDarwin [
{
name = "LIBRARY_PATH";
value = "${pkgs.libiconv}/lib";
}
{
name = "NIX_LDFLAGS";
value = "-L${pkgs.libiconv}/lib";
}
];
commands = [
{
category = "build";
name = "build";
help = "cargo build (debug)";
command = "cargo build \"$@\"";
}
{
category = "build";
name = "build-indexer";
help = "cargo build with indexer feature";
command = "cargo build --features indexer \"$@\"";
}
{
category = "build";
name = "build-release";
help = "cargo build --release";
command = "cargo build --release \"$@\"";
}
{
category = "check";
name = "check";
help = "cargo check --features indexer";
command = "cargo check --features indexer \"$@\"";
}
{
category = "check";
name = "clippy";
help = "cargo clippy --features indexer -- -D warnings (matches CI)";
command = "cargo clippy --features indexer \"$@\" -- -D warnings";
}
{
category = "check";
name = "fmt";
help = "cargo fmt";
command = "cargo fmt \"$@\"";
}
{
category = "check";
name = "fmt-check";
help = "cargo fmt --check (matches CI)";
command = "cargo fmt --check \"$@\"";
}
{
category = "check";
name = "run-tests";
help = "cargo test --features indexer (matches CI)";
command = "cargo test --features indexer \"$@\"";
}
{
category = "check";
name = "ci-local";
help = "run the same sequence CI runs: fmt-check, clippy, test";
command = ''
set -euo pipefail
cargo fmt --all -- --check
cargo clippy --features indexer --all-targets -- -D warnings
cargo test --features indexer
'';
}
{
category = "check";
name = "flake-check";
help = "nix flake check (full Nix CI checks)";
command = "nix flake check \"$@\"";
}
{
category = "check";
name = "a11y";
help = "static WCAG + HTML5 validation of frontend/index.html";
command = ''
set -euo pipefail
# Ignore CSS messages — the bundled vnu.jar predates Tailwind v4
# (oklch, @theme, @layer, color-mix). Our static WCAG script
# handles the design-token checks instead.
# Ignore CSS messages — the bundled vnu.jar predates Tailwind v4
# (oklch, @theme, @layer, color-mix). Our static WCAG script
# handles the design-token checks instead. Also skip the
# `type="text/tailwindcss"` style-attribute complaint.
html5validator --root frontend --match "*.html" \
--blacklist node_modules \
--ignore 'error: CSS:' \
'The only allowed value for the "type" attribute for the "style" element' \
"$@"
python3 scripts/a11y_check.py frontend/index.html
'';
}
{
category = "check";
name = "a11y-live";
help = "run pa11y-ci against a running nxv serve (needs `dev` in another terminal)";
command = ''
set -euo pipefail
if ! command -v curl >/dev/null 2>&1 || ! curl -sf http://localhost:8080/ >/dev/null; then
echo "a11y-live: no server on http://localhost:8080" >&2
echo " start one first with: dev" >&2
exit 1
fi
exec npx --yes pa11y-ci --config frontend/.pa11yci.json "$@"
'';
}
{
category = "check";
name = "coverage";
help = "test coverage summary (pass --html for a browsable report)";
command = ''
set -euo pipefail
LLVM_COV="$(find /nix/store -maxdepth 3 -name llvm-cov 2>/dev/null | head -1)"
LLVM_PROFDATA="$(find /nix/store -maxdepth 3 -name llvm-profdata 2>/dev/null | head -1)"
export LLVM_COV LLVM_PROFDATA
if [ "''${1:-}" = "--html" ]; then
cargo llvm-cov --features indexer --html --output-dir target/coverage
echo "Report: target/coverage/html/index.html"
else
cargo llvm-cov --features indexer --summary-only
fi
'';
}
{
category = "run";
name = "nxv";
help = "run nxv";
command = "cargo run -- \"$@\"";
}
{
category = "run";
name = "nxv-indexer";
help = "run nxv with the indexer feature";
command = "cargo run --features indexer -- \"$@\"";
}
{
category = "run";
name = "serve";
help = "start the nxv API server";
command = "cargo run -- serve \"$@\"";
}
{
category = "run";
name = "frontend-dev";
help = "serve the static frontend from ./frontend on :3030";
command = "miniserve --index index.html ./frontend \"$@\"";
}
{
category = "run";
name = "dev";
help = "API server + live frontend reload (cargo watch on src, disk-served HTML/JS on :8080)";
command = ''
set -euo pipefail
export NXV_FRONTEND_DIR="''${NXV_FRONTEND_DIR:-$PWD/frontend}"
echo "nxv dev · serving frontend from $NXV_FRONTEND_DIR"
echo "nxv dev · http://localhost:8080 (edit frontend/* → just refresh the browser)"
echo "nxv dev · src/ changes → cargo-watch auto-rebuilds and restarts"
exec cargo watch -q -w src -w Cargo.toml -x 'run -- serve --port 8080' "$@"
'';
}
{
category = "docs";
name = "docs-dev";
help = "start VitePress dev server for the docs site";
command = "cd website && bun install && bun run dev \"$@\"";
}
{
category = "docs";
name = "docs-build";
help = "build the documentation site";
command = "cd website && bun install && bun run build";
}
{
category = "docs";
name = "docs-preview";
help = "preview the built documentation site";
command = "cd website && bun run preview \"$@\"";
}
{
category = "docs";
name = "docs-fmt";
help = "format documentation with prettier";
command = "cd website && bun run fmt";
}
{
category = "deps";
name = "deps-outdated";
help = "list outdated crates";
command = "cargo outdated \"$@\"";
}
{
category = "deps";
name = "deps-audit";
help = "run cargo audit";
command = "cargo audit \"$@\"";
}
{
category = "deps";
name = "deps-update";
help = "cargo update + nix flake update";
command = ''
set -euo pipefail
cargo update
nix flake update
'';
}
{
category = "frontend";
name = "tw";
help = "compile Tailwind CSS (installs deps automatically)";
command = ''
cd frontend
if [ ! -d node_modules ]; then
echo "Installing Tailwind CSS dependencies (first-time setup)…"
npm install --prefer-offline
fi
# Content sources are pinned via @source directives in
# tailwind.src.css (index.html + app.js only).
node "./node_modules/@tailwindcss/cli/dist/index.mjs" \
-i tailwind.src.css \
-o tailwind.generated.css \
--minify
echo "✓ Generated frontend/tailwind.generated.css"
'';
}
{
category = "frontend";
name = "tw-dev";
help = "watch and recompile Tailwind CSS on changes";
command = ''
cd frontend
if [ ! -d node_modules ]; then
echo "Installing Tailwind CSS dependencies (first-time setup)…"
npm install --prefer-offline
fi
node "./node_modules/@tailwindcss/cli/dist/index.mjs" \
-i tailwind.src.css \
-o tailwind.generated.css \
--watch --minify
'';
}
];
};
treefmt = {
projectRootFile = "flake.nix";
programs.nixfmt.enable = true;
programs.rustfmt = {
enable = true;
edition = "2024";
};
};
};
};
}