-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve incrementality of nix build for orca using crane. This introduces a breaking change in `default.nix` which will require action in all downstream dependencies relying on `default.nix`
- Loading branch information
1 parent
ba546b9
commit 3813cce
Showing
6 changed files
with
131 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,58 @@ | ||
{ rustPlatform | ||
, pkg-config | ||
{ pkg-config | ||
, openssl | ||
, stdenv | ||
, darwin | ||
, lib | ||
, callPackage | ||
, texlive | ||
, makeWrapper | ||
, nix-gitignore | ||
, ibm-plex | ||
, buildFeatures ? [] | ||
, crane | ||
, system | ||
, lib | ||
, darwin | ||
}: | ||
let | ||
tex = import ./latex { inherit texlive; }; | ||
in | ||
rustPlatform.buildRustPackage { | ||
inherit buildFeatures; | ||
|
||
pname = "ict-union-orca"; | ||
version = "0.1.0"; | ||
src = nix-gitignore.gitignoreSource [] ./.; | ||
cargoSha256 = "sha256-iW18bgQwXIT6jL+PW3UxELqUzDJLxldAwwJv2FudB4o="; | ||
craneLib = crane.lib.${system}; | ||
nativeBuildInputs = [ | ||
openssl | ||
pkg-config | ||
]; | ||
|
||
nativeBuildInputs = [ pkg-config makeWrapper ]; | ||
# Build *just* the cargo dependencies, so we can reuse | ||
# all of that work (e.g. via cachix) when running in CI | ||
cargoArtifacts = craneLib.buildDepsOnly { | ||
inherit src nativeBuildInputs; | ||
}; | ||
|
||
buildInputs = [ openssl ] ++ lib.optionals stdenv.isDarwin [ | ||
darwin.apple_sdk.frameworks.Security | ||
]; | ||
postInstall = '' | ||
wrapProgram "$out/bin/orca" --suffix PATH : "${tex}/bin" | ||
# Run clippy (and deny all warnings) on the crate source, | ||
# resuing the dependency artifacts (e.g. from build scripts or | ||
# proc-macros) from above. | ||
# | ||
# Note that this is done as a separate derivation so it | ||
# does not impact building just the crate by itself. | ||
orca-clippy = craneLib.cargoClippy { | ||
inherit cargoArtifacts src nativeBuildInputs; | ||
cargoClippyExtraArgs = "-- --deny warnings"; | ||
}; | ||
|
||
orca-fmt = craneLib.cargoFmt { | ||
inherit src; | ||
}; | ||
in | ||
rec { | ||
orca = craneLib.buildPackage { | ||
inherit cargoArtifacts src; | ||
nativeBuildInputs = nativeBuildInputs ++ [ makeWrapper ]; | ||
buildInputs = [ openssl ] ++ lib.optionals stdenv.isDarwin [ | ||
darwin.apple_sdk.frameworks.Security | ||
]; | ||
postInstall = '' | ||
wrapProgram "$out/bin/orca" --suffix PATH : "${tex}/bin" | ||
''; | ||
}; | ||
|
||
inherit orca-clippy; | ||
inherit orca-fmt; | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters