diff options
author | Vincent Ambo <mail@tazj.in> | 2023-03-14T19·16+0300 |
---|---|---|
committer | tazjin <tazjin@tvl.su> | 2023-03-14T21·59+0000 |
commit | 231ed4c11e2dfb124d56138c39971ae02fcbc51a (patch) | |
tree | c7d3913ab44fe5d61e6c03fd632d221ab10880a1 /tvix/default.nix | |
parent | 790eac5a5c84929e5132d68070b2721c22382fe3 (diff) |
feat(tvix): build (some of) our Rust documentation in Nix r/6004
This will be published on docs.tvix.dev Change-Id: I348e057351d5295ad20953c9e9a32c257abab089 Reviewed-on: https://cl.tvl.fyi/c/depot/+/8298 Tested-by: BuildkiteCI Reviewed-by: flokli <flokli@flokli.de>
Diffstat (limited to 'tvix/default.nix')
-rw-r--r-- | tvix/default.nix | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/tvix/default.nix b/tvix/default.nix index b97d0dd00fff..19cb0fdd5aae 100644 --- a/tvix/default.nix +++ b/tvix/default.nix @@ -4,6 +4,16 @@ let # crate override for crates that need protobuf protobufDep = prev: (prev.nativeBuildInputs or [ ]) ++ [ pkgs.protobuf ]; + + # Cargo dependencies to be used with nixpkgs rustPlatform functions. + cargoDeps = pkgs.rustPlatform.importCargoLock { + lockFile = ./Cargo.lock; + outputHashes = { + "test-generator-0.3.0" = "08brp3qqa55hijc7xby3lam2cc84hvx1zzfqv6lj7smlczh8k32y"; + "tonic-mock-0.1.0" = "0lwa03hpp0mxa6aa1zv5w68k61y4hccfm0q2ykyq392fwal8vb50"; + "wu-manber-0.1.0" = "02byhfiw41mlgr1c43n2iq6jw5sbyn8l1acv5v71a07h5l18q0cy"; + }; + }; in { # Load the crate2nix crate tree. @@ -58,6 +68,27 @@ in ]; }; + # Build the Rust documentation for publishing on docs.tvix.dev. Currently only + # some crates are documented, as the crates that depend on Protobuf cause + # build failures. + rust-docs = pkgs.stdenv.mkDerivation { + inherit cargoDeps; + name = "tvix-rust-docs"; + src = depot.third_party.gitignoreSource ./.; + + nativeBuildInputs = with pkgs; [ + cargo + rust-analyzer + rustPlatform.cargoSetupHook + rustc + ]; + + buildPhase = '' + cargo doc --document-private-items -p tvix-eval -p tvix-serde -p nix-compat + mv target/doc $out + ''; + }; + export = (pkgs.runCommandLocal "export-tvix" { } '' echo "carrier for repo export extra-step" > $out '').overrideAttrs (_: { @@ -68,5 +99,5 @@ in }; }); - meta.ci.targets = [ "shell" "export" ]; + meta.ci.targets = [ "shell" "export" "rust-docs" ]; } |