mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-15 09:22:43 +03:00
7dfb9d1a1f
<!-- Thank you for submitting this PR! :) --> ## Description We'd like to speed up creation of all these Docker images, so this adds `dev-auth-webhook` to the Nix flake. Functional no-op. --------- Co-authored-by: Samir Talwar <samir.talwar@hasura.io> V3_GIT_ORIGIN_REV_ID: 384eb467b2fe7fba1644f5b4cc6224cdc043ce01
64 lines
1.7 KiB
Nix
64 lines
1.7 KiB
Nix
# This is a function that returns a derivation for the compiled Rust project.
|
|
{ craneLib
|
|
, lib
|
|
, version
|
|
, stdenv
|
|
, openssl
|
|
, libiconv
|
|
, pkg-config
|
|
, protobuf
|
|
, darwin
|
|
, pname
|
|
}:
|
|
let
|
|
buildArgs = {
|
|
inherit pname;
|
|
|
|
src =
|
|
let
|
|
isGraphqlFile = path: _type: builtins.match ".*graphql" path != null;
|
|
isHtmlFile = path: _type: builtins.match ".*html" path != null;
|
|
isJsonFile = path: _type: builtins.match ".*json" path != null;
|
|
isSourceFile = path: type:
|
|
isGraphqlFile path type
|
|
|| isHtmlFile path type
|
|
|| isJsonFile path type
|
|
|| craneLib.filterCargoSources path type;
|
|
in
|
|
lib.cleanSourceWith { src = craneLib.path ./..; filter = isSourceFile; };
|
|
|
|
buildInputs = [
|
|
openssl
|
|
] ++ lib.optionals stdenv.hostPlatform.isDarwin [
|
|
libiconv
|
|
darwin.apple_sdk.frameworks.Security
|
|
darwin.apple_sdk.frameworks.SystemConfiguration
|
|
];
|
|
|
|
nativeBuildInputs = [
|
|
pkg-config # required for non-static builds
|
|
protobuf # required by opentelemetry-proto, a dependency of axum-tracing-opentelemetry
|
|
];
|
|
};
|
|
|
|
# only build the binary we care about
|
|
cargoExtraArgs = "--package ${buildArgs.pname}";
|
|
|
|
# Build the dependencies first.
|
|
cargoArtifacts = craneLib.buildDepsOnly (buildArgs //
|
|
{
|
|
# without this we'll build deps for the entire workspace every time
|
|
buildPhaseCargoCommand = "cargo build --profile $CARGO_PROFILE --package ${buildArgs.pname}";
|
|
doCheck = false;
|
|
}
|
|
|
|
);
|
|
in
|
|
# Then build the crate.
|
|
craneLib.buildPackage
|
|
(buildArgs // {
|
|
inherit cargoArtifacts cargoExtraArgs;
|
|
doCheck = false;
|
|
RELEASE_VERSION = version;
|
|
})
|