packaging: don't block main crate build on its docs
This commit is contained in:
parent
ef1a6054ee
commit
1ca5aa2e97
1 changed files with 34 additions and 7 deletions
41
package.nix
41
package.nix
|
|
@ -67,7 +67,9 @@ in {
|
|||
inherit (self) strictDeps __structuredAttrs;
|
||||
inherit (self) doCheck doInstallCheck;
|
||||
|
||||
outputs = [ "out" "doc" ];
|
||||
outputs = [ "out" ];
|
||||
# "Fake" doc output, since it's actually built as a separate derivation.
|
||||
passthru.doc = self.dynixCrateDocs;
|
||||
|
||||
src = lib.fileset.toSource {
|
||||
root = ./.;
|
||||
|
|
@ -82,12 +84,6 @@ in {
|
|||
lockFile = ./Cargo.lock;
|
||||
};
|
||||
|
||||
postInstall = ''
|
||||
cargo doc --document-private-items
|
||||
mkdir -p "$doc"
|
||||
cp -r ./target/doc/* "$doc/"
|
||||
'';
|
||||
|
||||
nativeBuildInputs = rustHooks.asList ++ [
|
||||
cargo
|
||||
];
|
||||
|
|
@ -103,6 +99,37 @@ in {
|
|||
};
|
||||
};
|
||||
|
||||
# Run `cargo doc` as a separate derivation, so it can be run in parallel while the main
|
||||
# `cargo build` of `dynixCommand`.
|
||||
# This does effectively run `cargo check` twice, but that's by far the fastest part of the build,
|
||||
# so it's fine imo.
|
||||
dynixCrateDocs = stdenv.mkDerivation {
|
||||
pname = "${self.pname}-crate-docs";
|
||||
inherit (self) version;
|
||||
inherit (self) strictDeps __structuredAttrs;
|
||||
inherit (self.dynixCommand) src cargoDeps nativeBuildInputs;
|
||||
|
||||
phases = [ "unpackPhase" "patchPhase" "cargoDocPhase" "installPhase" ];
|
||||
|
||||
cargoDocPhase = ''
|
||||
runHook preCargoDoc
|
||||
cargo doc --document-private-items
|
||||
runHook postCargoDoc
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
mkdir -p "$out"
|
||||
cp -r ./target/doc/* "$out"
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = "Crate Rustdoc for Dynix";
|
||||
inherit (self.meta) license;
|
||||
};
|
||||
};
|
||||
|
||||
dynixModules = stdenv.mkDerivation {
|
||||
pname = "${self.pname}-modules";
|
||||
inherit (self) version;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue