From b16fedebe7395476d1fe0513bac2fb6eeee7da06 Mon Sep 17 00:00:00 2001 From: LGUG2Z Date: Thu, 5 Nov 2026 13:05:56 -0800 Subject: [PATCH] docs(nixgen): schemars-nixgen has a README, and the docs say how to run it --- crates/schemars-nixgen/README.md | 17 +++++++++++++++++ docs/linux/CONTRIBUTING.md | 4 ++-- 2 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 crates/schemars-nixgen/README.md diff --git a/crates/schemars-nixgen/README.md b/crates/schemars-nixgen/README.md new file mode 100644 index 00000000..c6b1cc16 --- /dev/null +++ b/crates/schemars-nixgen/README.md @@ -0,0 +1,17 @@ +# schemars-nixgen + +Writes Nix module options from a JSON Schema made by `schemars`. komorebi's NixOS and nix-darwin modules type their +`config` with the options it writes from `schemas//schema.json`. + +It is a development tool: no release ships it, and it is not a default member of the workspace, so a bare +`cargo build` leaves it out. Run it from the tree: + +```sh +just nixgen-linux # nix/linux/komorebi-options.nix +just nixgen-macos # nix/macos/komorebi-options.nix and komorebi-bar-options.nix +``` + +The first line of what it writes is `# schema-sha256: `, the hash of the schema it was made from, which is how +the `linux-schema-fresh` check tells that the options are stale without running it. + +`nix build .#schemars-nixgen` builds it, and `nix build .#checkSets.nixgen-lint .#checkSets.nixgen-test` check it. diff --git a/docs/linux/CONTRIBUTING.md b/docs/linux/CONTRIBUTING.md index 984d1efd..c7353d85 100644 --- a/docs/linux/CONTRIBUTING.md +++ b/docs/linux/CONTRIBUTING.md @@ -75,8 +75,8 @@ on machines built with the module too. Three files are generated from the Rust types and committed: `schemas/linux/schema.json` and `schemas/linux/schema.asc.json` (`just jsonschema`), and `nix/linux/komorebi-options.nix`, which types the -module's `config` (`just nixgen`, which needs `schemars-nixgen`, `cargo install -schemars-nixgen`). A change to what `komorebi.json` or an `applications.json` can +module's `config` (`just nixgen-linux`, which runs `schemars-nixgen`, built from +[`crates/schemars-nixgen`](../../crates/schemars-nixgen)). A change to what `komorebi.json` or an `applications.json` can say regenerates them in the same commit, and the check `schema-fresh` fails when it does not. The first line of the options file is the hash of the schema it was made from, which is how the check tells without running `schemars-nixgen`.