diff --git a/README.md b/README.md index ad6f2ac..e02b585 100644 --- a/README.md +++ b/README.md @@ -211,6 +211,7 @@ For VSCode, load the dev shell via Nix Env Selector extension or direnv. ## Documentation +- [API Reference](https://nixops4.github.io/nix-bindings-rust/development/) - [Changelog](CHANGELOG.md) - [Nix C API Reference][C API] - [nix-cargo-integration][nix-cargo-integration] diff --git a/dev/flake-module.nix b/dev/flake-module.nix index 384a2d8..4ca895a 100644 --- a/dev/flake-module.nix +++ b/dev/flake-module.nix @@ -1,5 +1,6 @@ { inputs, + withSystem, ... }: { @@ -56,6 +57,119 @@ ''}"; }; + # Combined rustdoc for all crates with cross-linking. + # NOTE: nci.outputs.nix-bindings.docs uses doc-merge which doesn't support + # rustdoc's new sharded search index format (Rust 1.78+). + # See https://github.com/90-008/nix-cargo-integration/issues/198 + # Instead, we build all workspace crates together so rustdoc can link them. + packages.docs = + let + # Use nix-bindings-flake (has most transitive deps) as base + base = config.nci.outputs.nix-bindings-flake.packages.release; + crates = [ + "nix-bindings-bdwgc-sys" + "nix-bindings-util-sys" + "nix-bindings-util" + "nix-bindings-store-sys" + "nix-bindings-store" + "nix-bindings-expr-sys" + "nix-bindings-expr" + "nix-bindings-fetchers-sys" + "nix-bindings-fetchers" + "nix-bindings-flake-sys" + "nix-bindings-flake" + ]; + packageFlags = pkgs.lib.concatMapStringsSep " " (c: "-p ${c}") crates; + in + (base.extendModules { + modules = [ + { + mkDerivation = { + # Build docs for all crates together (enabling cross-crate linking) + buildPhase = pkgs.lib.mkForce '' + cargo doc $cargoBuildFlags --no-deps --profile $cargoBuildProfile ${packageFlags} + ''; + checkPhase = pkgs.lib.mkForce ":"; + installPhase = pkgs.lib.mkForce '' + mv target/$CARGO_BUILD_TARGET/doc $out + + # Find rustdoc assets (have hashes in filenames) + find_asset() { + local pattern="$1" + local matches=($out/static.files/$pattern) + if [[ ''${#matches[@]} -ne 1 || ! -e "''${matches[0]}" ]]; then + echo "Expected exactly one match for $pattern, found: ''${matches[*]}" >&2 + exit 1 + fi + basename "''${matches[0]}" + } + rustdoc_css=$(find_asset 'rustdoc-*.css') + normalize_css=$(find_asset 'normalize-*.css') + storage_js=$(find_asset 'storage-*.js') + + cat > $out/index.html < + + + + nix-bindings-rust + + + + + + +

nix-bindings-rust

+

Rust bindings for the Nix C API

+

Crates

+ +
+

Low-level bindings

+

+ These -sys crates provide raw FFI bindings generated by + bindgen. + They expose the C API directly without safety wrappers. + Most users should prefer the high-level crates above. +

+ +
+ + + EOF + ''; + }; + } + ]; + }).config.public; + devShells.default = pkgs.mkShell { name = "nix-bindings-devshell"; strictDeps = true; @@ -105,9 +219,24 @@ }; }; herculesCI = - { ... }: + hci@{ lib, ... }: { ciSystems = [ "x86_64-linux" ]; + onPush.default.outputs = { + effects.pushDocs = lib.optionalAttrs (hci.config.repo.branch == "main") ( + withSystem "x86_64-linux" ( + { config, hci-effects, ... }: + hci-effects.gitWriteBranch { + git.checkout.remote.url = hci.config.repo.remoteHttpUrl; + git.checkout.forgeType = "github"; + git.checkout.user = "x-access-token"; + git.update.branch = "gh-pages"; + contents = config.packages.docs; + destination = "development"; # directory + } + ) + ); + }; }; hercules-ci.flake-update = { enable = true; diff --git a/nix-bindings-bdwgc-sys/Cargo.toml b/nix-bindings-bdwgc-sys/Cargo.toml index 734663e..488f41e 100644 --- a/nix-bindings-bdwgc-sys/Cargo.toml +++ b/nix-bindings-bdwgc-sys/Cargo.toml @@ -6,6 +6,7 @@ build = "build.rs" license = "LGPL-2.1" description = "Low-level FFI bindings to the Boehm-Demers-Weiser garbage collector" repository = "https://github.com/nixops4/nix-bindings-rust" +documentation = "https://nixops4.github.io/nix-bindings-rust/development/nix_bindings_bdwgc_sys/" readme = "README.md" [lib] diff --git a/nix-bindings-bdwgc-sys/README.md b/nix-bindings-bdwgc-sys/README.md index 80988a5..b49b5b4 100644 --- a/nix-bindings-bdwgc-sys/README.md +++ b/nix-bindings-bdwgc-sys/README.md @@ -3,6 +3,8 @@ This crate contains generated bindings for the Boehm-Demers-Weiser garbage collector (`bdw-gc`). **You should not have to use this crate directly,** and so you should probably not add it to your dependencies. +[API Documentation](https://nixops4.github.io/nix-bindings-rust/development/nix_bindings_bdwgc_sys/) + ## Changelog See the [nix-bindings-rust changelog](https://github.com/nixops4/nix-bindings-rust/blob/main/CHANGELOG.md). diff --git a/nix-bindings-expr-sys/Cargo.toml b/nix-bindings-expr-sys/Cargo.toml index 4f8e373..0cf3e12 100644 --- a/nix-bindings-expr-sys/Cargo.toml +++ b/nix-bindings-expr-sys/Cargo.toml @@ -6,6 +6,7 @@ build = "build.rs" license = "LGPL-2.1" description = "Low-level FFI bindings to the Nix expression evaluator" repository = "https://github.com/nixops4/nix-bindings-rust" +documentation = "https://nixops4.github.io/nix-bindings-rust/development/nix_bindings_expr_sys/" readme = "README.md" [lib] diff --git a/nix-bindings-expr-sys/README.md b/nix-bindings-expr-sys/README.md index 906f366..9fdb3a0 100644 --- a/nix-bindings-expr-sys/README.md +++ b/nix-bindings-expr-sys/README.md @@ -4,6 +4,8 @@ This crate contains generated bindings for the Nix C API (`nix-expr-c`). **You should not have to use this crate directly,** and so you should probably not add it to your dependencies. Instead, use the `nix-bindings-expr` crate, which _should_ be sufficient. +[API Documentation](https://nixops4.github.io/nix-bindings-rust/development/nix_bindings_expr_sys/) + ## Changelog See the [nix-bindings-rust changelog](https://github.com/nixops4/nix-bindings-rust/blob/main/CHANGELOG.md). diff --git a/nix-bindings-expr/Cargo.toml b/nix-bindings-expr/Cargo.toml index 4b1c777..ef9a373 100644 --- a/nix-bindings-expr/Cargo.toml +++ b/nix-bindings-expr/Cargo.toml @@ -6,6 +6,7 @@ build = "build.rs" license = "LGPL-2.1" description = "Rust bindings to Nix expression evaluator" repository = "https://github.com/nixops4/nix-bindings-rust" +documentation = "https://nixops4.github.io/nix-bindings-rust/development/nix_bindings_expr/" readme = "README.md" [lib] diff --git a/nix-bindings-expr/README.md b/nix-bindings-expr/README.md index ebd889a..cb92996 100644 --- a/nix-bindings-expr/README.md +++ b/nix-bindings-expr/README.md @@ -2,6 +2,8 @@ Rust bindings to the Nix expression evaluator. +[API Documentation](https://nixops4.github.io/nix-bindings-rust/development/nix_bindings_expr/) + ## Changelog See the [nix-bindings-rust changelog](https://github.com/nixops4/nix-bindings-rust/blob/main/CHANGELOG.md). diff --git a/nix-bindings-fetchers-sys/Cargo.toml b/nix-bindings-fetchers-sys/Cargo.toml index 99ff741..2dfaa3b 100644 --- a/nix-bindings-fetchers-sys/Cargo.toml +++ b/nix-bindings-fetchers-sys/Cargo.toml @@ -6,6 +6,7 @@ build = "build.rs" license = "LGPL-2.1" description = "Low-level FFI bindings to the nix-fetchers library" repository = "https://github.com/nixops4/nix-bindings-rust" +documentation = "https://nixops4.github.io/nix-bindings-rust/development/nix_bindings_fetchers_sys/" readme = "README.md" [lib] diff --git a/nix-bindings-fetchers-sys/README.md b/nix-bindings-fetchers-sys/README.md index 87113b6..8230b81 100644 --- a/nix-bindings-fetchers-sys/README.md +++ b/nix-bindings-fetchers-sys/README.md @@ -4,6 +4,8 @@ This crate contains generated bindings for the Nix C API (`nix-fetchers-c`). **You should not have to use this crate directly,** and so you should probably not add it to your dependencies. Instead, use the `nix-bindings-fetchers` crate, which _should_ be sufficient. +[API Documentation](https://nixops4.github.io/nix-bindings-rust/development/nix_bindings_fetchers_sys/) + ## Changelog See the [nix-bindings-rust changelog](https://github.com/nixops4/nix-bindings-rust/blob/main/CHANGELOG.md). diff --git a/nix-bindings-fetchers/Cargo.toml b/nix-bindings-fetchers/Cargo.toml index e0d06cb..4ae993d 100644 --- a/nix-bindings-fetchers/Cargo.toml +++ b/nix-bindings-fetchers/Cargo.toml @@ -5,6 +5,7 @@ edition = "2021" license = "LGPL-2.1" description = "Rust bindings to Nix fetchers" repository = "https://github.com/nixops4/nix-bindings-rust" +documentation = "https://nixops4.github.io/nix-bindings-rust/development/nix_bindings_fetchers/" readme = "README.md" [lib] diff --git a/nix-bindings-fetchers/README.md b/nix-bindings-fetchers/README.md index 6d23b13..b8f3941 100644 --- a/nix-bindings-fetchers/README.md +++ b/nix-bindings-fetchers/README.md @@ -2,6 +2,8 @@ Rust bindings to the nix-fetchers library. +[API Documentation](https://nixops4.github.io/nix-bindings-rust/development/nix_bindings_fetchers/) + ## Changelog See the [nix-bindings-rust changelog](https://github.com/nixops4/nix-bindings-rust/blob/main/CHANGELOG.md). diff --git a/nix-bindings-flake-sys/Cargo.toml b/nix-bindings-flake-sys/Cargo.toml index fe83419..987cd6d 100644 --- a/nix-bindings-flake-sys/Cargo.toml +++ b/nix-bindings-flake-sys/Cargo.toml @@ -6,6 +6,7 @@ build = "build.rs" license = "LGPL-2.1" description = "Low-level FFI bindings to Nix flakes" repository = "https://github.com/nixops4/nix-bindings-rust" +documentation = "https://nixops4.github.io/nix-bindings-rust/development/nix_bindings_flake_sys/" readme = "README.md" [lib] diff --git a/nix-bindings-flake-sys/README.md b/nix-bindings-flake-sys/README.md index 84114d7..1d26c8d 100644 --- a/nix-bindings-flake-sys/README.md +++ b/nix-bindings-flake-sys/README.md @@ -4,6 +4,8 @@ This crate contains generated bindings for the Nix C API (`nix-flake-c`). **You should not have to use this crate directly,** and so you should probably not add it to your dependencies. Instead, use the `nix-bindings-flake` crate, which _should_ be sufficient. +[API Documentation](https://nixops4.github.io/nix-bindings-rust/development/nix_bindings_flake_sys/) + ## Changelog See the [nix-bindings-rust changelog](https://github.com/nixops4/nix-bindings-rust/blob/main/CHANGELOG.md). diff --git a/nix-bindings-flake/Cargo.toml b/nix-bindings-flake/Cargo.toml index 336b1f8..5fbb42a 100644 --- a/nix-bindings-flake/Cargo.toml +++ b/nix-bindings-flake/Cargo.toml @@ -5,6 +5,7 @@ edition = "2021" license = "LGPL-2.1" description = "Rust bindings to Nix flakes" repository = "https://github.com/nixops4/nix-bindings-rust" +documentation = "https://nixops4.github.io/nix-bindings-rust/development/nix_bindings_flake/" readme = "README.md" [lib] diff --git a/nix-bindings-flake/README.md b/nix-bindings-flake/README.md index 6fda25d..43dd11b 100644 --- a/nix-bindings-flake/README.md +++ b/nix-bindings-flake/README.md @@ -2,6 +2,8 @@ Rust bindings to Nix flakes. +[API Documentation](https://nixops4.github.io/nix-bindings-rust/development/nix_bindings_flake/) + ## Changelog See the [nix-bindings-rust changelog](https://github.com/nixops4/nix-bindings-rust/blob/main/CHANGELOG.md). diff --git a/nix-bindings-store-sys/Cargo.toml b/nix-bindings-store-sys/Cargo.toml index f9f5ee2..9e8c374 100644 --- a/nix-bindings-store-sys/Cargo.toml +++ b/nix-bindings-store-sys/Cargo.toml @@ -6,6 +6,7 @@ build = "build.rs" license = "LGPL-2.1" description = "Low-level FFI bindings to the Nix store library" repository = "https://github.com/nixops4/nix-bindings-rust" +documentation = "https://nixops4.github.io/nix-bindings-rust/development/nix_bindings_store_sys/" readme = "README.md" [lib] diff --git a/nix-bindings-store-sys/README.md b/nix-bindings-store-sys/README.md index 31a2d7e..936505d 100644 --- a/nix-bindings-store-sys/README.md +++ b/nix-bindings-store-sys/README.md @@ -4,6 +4,8 @@ This crate contains generated bindings for the Nix C API (`nix-store-c`). **You should not have to use this crate directly,** and so you should probably not add it to your dependencies. Instead, use the `nix-bindings-store` crate, which _should_ be sufficient. +[API Documentation](https://nixops4.github.io/nix-bindings-rust/development/nix_bindings_store_sys/) + ## Changelog See the [nix-bindings-rust changelog](https://github.com/nixops4/nix-bindings-rust/blob/main/CHANGELOG.md). diff --git a/nix-bindings-store/Cargo.toml b/nix-bindings-store/Cargo.toml index 83aab99..24336db 100644 --- a/nix-bindings-store/Cargo.toml +++ b/nix-bindings-store/Cargo.toml @@ -6,6 +6,7 @@ build = "build.rs" license = "LGPL-2.1" description = "Rust bindings to Nix store library" repository = "https://github.com/nixops4/nix-bindings-rust" +documentation = "https://nixops4.github.io/nix-bindings-rust/development/nix_bindings_store/" readme = "README.md" [lib] diff --git a/nix-bindings-store/README.md b/nix-bindings-store/README.md index 1df35eb..8002364 100644 --- a/nix-bindings-store/README.md +++ b/nix-bindings-store/README.md @@ -2,6 +2,8 @@ Rust bindings to the Nix store library. +[API Documentation](https://nixops4.github.io/nix-bindings-rust/development/nix_bindings_store/) + ## Changelog See the [nix-bindings-rust changelog](https://github.com/nixops4/nix-bindings-rust/blob/main/CHANGELOG.md). diff --git a/nix-bindings-util-sys/Cargo.toml b/nix-bindings-util-sys/Cargo.toml index 7a0d01c..2441074 100644 --- a/nix-bindings-util-sys/Cargo.toml +++ b/nix-bindings-util-sys/Cargo.toml @@ -6,6 +6,7 @@ build = "build.rs" license = "LGPL-2.1" description = "Low-level FFI bindings to Nix utility library" repository = "https://github.com/nixops4/nix-bindings-rust" +documentation = "https://nixops4.github.io/nix-bindings-rust/development/nix_bindings_util_sys/" readme = "README.md" [lib] diff --git a/nix-bindings-util-sys/README.md b/nix-bindings-util-sys/README.md index 7e762d5..b504cb8 100644 --- a/nix-bindings-util-sys/README.md +++ b/nix-bindings-util-sys/README.md @@ -4,6 +4,8 @@ This crate contains generated bindings for the Nix C API (`nix-util-c`). **You should not have to use this crate directly,** and so you should probably not add it to your dependencies. Instead, use the `nix-bindings-util` crate, which _should_ be sufficient. +[API Documentation](https://nixops4.github.io/nix-bindings-rust/development/nix_bindings_util_sys/) + ## Changelog See the [nix-bindings-rust changelog](https://github.com/nixops4/nix-bindings-rust/blob/main/CHANGELOG.md). diff --git a/nix-bindings-util/Cargo.toml b/nix-bindings-util/Cargo.toml index 6a32fb1..78e8353 100644 --- a/nix-bindings-util/Cargo.toml +++ b/nix-bindings-util/Cargo.toml @@ -5,6 +5,7 @@ edition = "2021" license = "LGPL-2.1" description = "Rust bindings to Nix utility library" repository = "https://github.com/nixops4/nix-bindings-rust" +documentation = "https://nixops4.github.io/nix-bindings-rust/development/nix_bindings_util/" readme = "README.md" [lib] diff --git a/nix-bindings-util/README.md b/nix-bindings-util/README.md index 895b7cf..0a29f29 100644 --- a/nix-bindings-util/README.md +++ b/nix-bindings-util/README.md @@ -2,6 +2,8 @@ Rust bindings to the Nix utility library. +[API Documentation](https://nixops4.github.io/nix-bindings-rust/development/nix_bindings_util/) + ## Changelog See the [nix-bindings-rust changelog](https://github.com/nixops4/nix-bindings-rust/blob/main/CHANGELOG.md).