Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/scripts/id-pr-checks.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ shellcheck-check
shfmt-check
statix-check
taplo-check
justfmt-check
clippy-lint
web-lint
cargo-check
Expand Down
14 changes: 13 additions & 1 deletion pkgs/id/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@

# =======================================================================
# Formatter: nix fmt
# Uses treefmt to orchestrate rustfmt + biome + prettier + nixfmt + statix + shfmt + taplo
# Uses treefmt to orchestrate rustfmt + biome + prettier + nixfmt + statix + shfmt + taplo + just
# =======================================================================
formatter = pkgs.writeShellScriptBin "formatter" ''
export PATH="${pkgs.lib.makeBinPath fmtBins}:$PATH"
Expand Down Expand Up @@ -599,6 +599,18 @@
echo "taplo-check passed at $(date)" > $out/result.txt
'';
};
justfmt-check = pkgs.stdenv.mkDerivation {
name = "id-justfmt-check";
src = ./.;
nativeBuildInputs = [ pkgs.just ];
buildPhase = ''
just --fmt --check --justfile ./justfile
'';
installPhase = ''
mkdir -p $out
echo "justfmt-check passed at $(date)" > $out/result.txt
'';
};
prettier-check = pkgs.stdenv.mkDerivation {
name = "id-prettier-check";
src = ./.;
Expand Down
32 changes: 16 additions & 16 deletions pkgs/id/justfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ default: kill-serve

# Show available recipes
list:
@just --list
@just --list

# =============================================================================
# Quality Checks
Expand Down Expand Up @@ -59,7 +59,7 @@ treefmt *args:
unset TREEFMT_TREE_ROOT TREEFMT_TREE_ROOT_CMD TREEFMT_TREE_ROOT_FILE
# Translate --check to --fail-on-change (treefmt v2 renamed the flag)
translated_args=()
for arg in {{args}}; do
for arg in {{ args }}; do
case "$arg" in
--check) translated_args+=(--fail-on-change) ;;
*) translated_args+=("$arg") ;;
Expand All @@ -78,7 +78,7 @@ treefmt-no-cache *args:
unset TREEFMT_TREE_ROOT TREEFMT_TREE_ROOT_CMD TREEFMT_TREE_ROOT_FILE
# Translate --check to --fail-on-change (treefmt v2 renamed the flag)
translated_args=()
for arg in {{args}}; do
for arg in {{ args }}; do
case "$arg" in
--check) translated_args+=(--fail-on-change) ;;
*) translated_args+=("$arg") ;;
Expand Down Expand Up @@ -279,7 +279,7 @@ alias test-lib := test-unit

# Run the F11.8 benchmark harness (issue #539): journal append+fsync, checkpoint compaction, guest replay, session fan-out
bench *args:
cargo bench --bench world_bench -- {{args}}
cargo bench --bench world_bench -- {{ args }}

# Run integration tests only
[group('test')]
Expand All @@ -299,7 +299,7 @@ test-int-sandbox:
# pair (#869; 3 → 4 shards in #551 to rebalance the ~12.5 min shards).
[group('test')]
test-shard-sandbox SHARD COUNT:
bash scripts/test-shard-sandbox.sh {{SHARD}} {{COUNT}}
bash scripts/test-shard-sandbox.sh {{ SHARD }} {{ COUNT }}

# Run tests with output shown
[group('test')]
Expand All @@ -309,7 +309,7 @@ test-verbose:
# Run a specific test by name
[group('test')]
test-one NAME:
cargo test --all-features {{NAME}}
cargo test --all-features {{ NAME }}

# [bun] Run web tests (Rust + TypeScript unit tests + type checking)
[group('test')]
Expand Down Expand Up @@ -527,7 +527,7 @@ alias web-dev := web-assets-dev
# Run CLI with arguments (lib variant)
[group('run')]
run *ARGS:
cargo run -- {{ARGS}}
cargo run -- {{ ARGS }}

# Serve with web UI (default) [bun]
[group('run')]
Expand All @@ -536,12 +536,12 @@ serve *ARGS: web (serve-web ARGS)
# Serve with web UI (skip asset build, requires pre-built assets)
[group('run')]
serve-web *ARGS:
cargo run --features web -- serve --web {{ARGS}}
cargo run --features web -- serve --web {{ ARGS }}

# Serve without web UI
[group('run')]
serve-lib *ARGS:
cargo run -- serve {{ARGS}}
cargo run -- serve {{ ARGS }}

# Serve a new instance with web UI and auto-assigned port (creates .iroh/<name>/) [bun]
[group('run')]
Expand All @@ -550,12 +550,12 @@ serve-new NAME="" *ARGS: web (serve-new-web NAME ARGS)
# Serve a new instance with web UI (skip asset build, requires pre-built assets)
[group('run')]
serve-new-web NAME="" *ARGS:
cargo run --features web -- {{ if NAME != "" { "--new=" + NAME } else { "--new=" } }} serve --web --port 0 {{ARGS}}
cargo run --features web -- {{ if NAME != "" { "--new=" + NAME } else { "--new=" } }} serve --web --port 0 {{ ARGS }}

# Serve a new instance without web UI and auto-assigned port
[group('run')]
serve-new-lib NAME="" *ARGS:
cargo run -- {{ if NAME != "" { "--new=" + NAME } else { "--new=" } }} serve --port 0 {{ARGS}}
cargo run -- {{ if NAME != "" { "--new=" + NAME } else { "--new=" } }} serve --port 0 {{ ARGS }}

# Build then serve with web UI [bun]
[group('run')]
Expand All @@ -569,7 +569,7 @@ kill:
# Sleep for specified seconds (default 0.6)
[group('run')]
sleep SECONDS="0.6":
sleep {{SECONDS}}
sleep {{ SECONDS }}

# Kill and restart serve with web UI [bun] [alias: default]
[group('run')]
Expand Down Expand Up @@ -658,7 +658,7 @@ chown:
update-input +inputs:
#!/usr/bin/env bash
set -euo pipefail
for input in {{inputs}}; do
for input in {{ inputs }}; do
echo "--- Updating $input ---"
nix flake update "$input"
done
Expand All @@ -674,10 +674,10 @@ alias update-all-inputs := update-inputs-all
[private]
_nixpkgs-inputs ref="":
#!/usr/bin/env bash
if [ -z "{{ref}}" ]; then
if [ -z "{{ ref }}" ]; then
nix eval --raw --impure --expr 'import ./nix/nixpkgs-inputs.nix {}'
else
nix eval --raw --impure --expr "import ./nix/nixpkgs-inputs.nix { ref = \"{{ref}}\"; }"
nix eval --raw --impure --expr "import ./nix/nixpkgs-inputs.nix { ref = \"{{ ref }}\"; }"
fi

# Update all direct NixOS/nixpkgs inputs (any branch)
Expand Down Expand Up @@ -743,7 +743,7 @@ update-nixpkgs-unstable-only:
# Run a single nix flake check by name (e.g. just check-one test-unit)
[group('nix')]
check-one NAME:
nix build -L .#checks.x86_64-linux.{{NAME}}
nix build -L .#checks.x86_64-linux.{{ NAME }}

# Build nix package — web variant (nix build)
[group('nix')]
Expand Down
6 changes: 6 additions & 0 deletions pkgs/id/treefmt.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
# statix - Nix linter/fixer
# shfmt - Shell scripts
# taplo - TOML files
# just - justfile

[global]
excludes = [
Expand Down Expand Up @@ -59,3 +60,8 @@ options = ["-i", "2", "-s", "-w"]
command = "taplo"
options = ["fmt"]
includes = ["*.toml"]

[formatter.just]
command = "bash"
options = ["-c", "for f in \"$@\"; do just --fmt --justfile \"$f\"; done", "_"]
includes = ["justfile"]
Loading