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
44 changes: 44 additions & 0 deletions pkgs/id/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# pkgs/id is a standalone flake: its checks build from a source copy of
# this directory alone, so the repository-root .editorconfig is not
# visible inside the Nix sandbox. Tools that read editorconfig
# (prettier, shfmt) therefore formatted differently in CI than in a
# working tree — e.g. prettier's markdown print width comes from the
# [*.md] max_line_length rule below (#702). Keep this file in sync
# with the root .editorconfig rules that cover files under pkgs/id.
root = true

[*]
charset=utf-8
end_of_line=lf
indent_size=2
indent_style=space
insert_final_newline=true
trim_trailing_whitespace=true

[*.{bzl, py}]
indent_size = 4

[*.{nix}]
indent_size = 2

[*.md]
max_line_length=off
trim_trailing_whitespace=false

[doc/**/transcript.txt]
trim_trailing_whitespace = false
insert_final_newline = false
end_of_line = unset

[*.{diff,patch}]
end_of_line=unset
indent_size=unset
insert_final_newline=unset
trim_trailing_whitespace=unset

[{LICENSES/**,LICENSE*}]
charset=unset
end_of_line=unset
indent_size=unset
insert_final_newline=unset
trim_trailing_whitespace=unset
8 changes: 6 additions & 2 deletions pkgs/id/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,14 @@ p2panda-sync = { path = "vendor/p2panda-sync" }
# Group membership and the auth DAG (P2.1). The `serde` feature (P2.3) serializes group actions,
# which the event store keeps with each group operation. `test_utils` is not enabled: it turns on
# test-only behaviour in p2panda-core, so the test types come from our own tests.
p2panda-auth = { git = "https://github.com/p2panda/p2panda", rev = "3e84cac48bba05c6857cce2ec433862b97f8d53c", features = ["serde"] }
p2panda-auth = { git = "https://github.com/p2panda/p2panda", rev = "3e84cac48bba05c6857cce2ec433862b97f8d53c", features = [
"serde",
] }
# DataScheme group encryption (P4.1, src/encryption/). `data_scheme` is on because the adapter is the
# scheme. `test_utils` and `message_scheme` stay off: the adapter brings its own orderer and membership.
p2panda-encryption = { path = "vendor/p2panda-encryption", default-features = false, features = ["data_scheme"] }
p2panda-encryption = { path = "vendor/p2panda-encryption", default-features = false, features = [
"data_scheme",
] }
postcard = { version = "1", features = ["alloc"] }
rand = "0.10"
redb = "=4.3.0"
Expand Down
37 changes: 23 additions & 14 deletions pkgs/id/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@
src = ./.;
nativeBuildInputs = fmtBins;
buildPhase = ''
treefmt --config-file ./treefmt.toml --tree-root "$(pwd)" --ci 2>&1 || true
treefmt --config-file ./treefmt.toml --tree-root "$(pwd)" --ci 2>&1
'';
installPhase = ''
mkdir -p $out
Expand Down Expand Up @@ -442,8 +442,7 @@
nativeBuildInputs = [ rustToolchain ];
buildPhase = ''
find . -name '*.rs' -not -path '*/target/*' \
-exec rustfmt --check --edition 2024 {} + \
|| true
-exec rustfmt --check --edition 2024 {} +
'';
installPhase = ''
mkdir -p $out
Expand All @@ -455,9 +454,17 @@
src = ./.;
nativeBuildInputs = [ pkgs.statix ];
buildPhase = ''
find . -name '*.nix' -print0 | while IFS= read -r -d "" f; do
statix check -- "$f" || true
done
# Collect failures across files instead of swallowing each
# one: a pipe into `while` would run the loop in a subshell
# and lose the flag, so feed it via process substitution.
fail=0
while IFS= read -r -d "" f; do
statix check -- "$f" || fail=1
done < <(find . -name '*.nix' -print0)
if [ "$fail" -ne 0 ]; then
echo "statix-check: statix reported problems above" >&2
false
fi
'';
installPhase = ''
mkdir -p $out
Expand All @@ -470,8 +477,7 @@
nativeBuildInputs = [ pkgs.shfmt ];
buildPhase = ''
find . -name '*.sh' -not -path '*/node_modules/*' \
-exec shfmt -d -i 2 -s {} + \
|| true
-exec shfmt -d -i 2 -s {} +
'';
installPhase = ''
mkdir -p $out
Expand All @@ -483,9 +489,14 @@
src = ./.;
nativeBuildInputs = [ pkgs.shellcheck ];
buildPhase = ''
# Enforced at warning severity (#702): under sandbox
# conditions shellcheck reports only four info findings
# (SC2012, `ls` glob picks in the examples' build.sh
# files) and no warning-or-above findings, so warnings
# and errors fail the gate while those info findings
# are worked down separately.
find . -name '*.sh' -not -path '*/node_modules/*' \
-exec shellcheck {} + \
|| true
-exec shellcheck --severity=warning {} +
'';
installPhase = ''
mkdir -p $out
Expand All @@ -498,8 +509,7 @@
nativeBuildInputs = [ pkgs.taplo ];
buildPhase = ''
find . -name '*.toml' -not -path '*/target/*' \
-exec taplo check {} + \
|| true
-exec taplo check {} +
'';
installPhase = ''
mkdir -p $out
Expand All @@ -515,8 +525,7 @@
-o -name '*.scss' -o -name '*.yaml' \) \
-not -path '*/node_modules/*' -not -path '*/target/*' \
-not -path '*/dist/*' \
-exec prettier --check {} + \
|| true
-exec prettier --check {} +
'';
installPhase = ''
mkdir -p $out
Expand Down
9 changes: 9 additions & 0 deletions pkgs/id/statix.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# pkgs/id is a standalone flake: its checks build from a source copy of
# this directory alone, so the repository-root statix.toml is not
# visible inside the Nix sandbox. Without this file the sandbox run
# enables lints the project deliberately turned off — repeated_keys
# (W20) fires on the idiomatic dotted `nodes.<name>` paths in the
# NixOS VM test files (#702). Keep in sync with the root statix.toml.
disabled = ["repeated_keys"]
nix_version = '2.23'
ignore = ['.direnv']
2 changes: 2 additions & 0 deletions pkgs/id/treefmt.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ excludes = [
"web/bun.nix",
"e2e/bun.nix",
"flake.lock",
# Vendored upstream crates: do not reformat code we do not own (#702).
"vendor/**",
]

[formatter.rustfmt]
Expand Down
Loading