mirror of
https://gitlab.com/famedly/conduit.git
synced 2024-12-27 04:53:50 +03:00
only set CONDUIT_VERSION_EXTRA
for final build
This prevents us from needing to recompile the dependencies when that environment variable changes, which generally changes on every commit, which is far more frequently than the dependencies are actually changed.
This commit is contained in:
parent
55259329a3
commit
96cc1f6abd
1 changed files with 42 additions and 34 deletions
|
@ -14,15 +14,13 @@
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
env =
|
buildDepsOnlyEnv =
|
||||||
let
|
let
|
||||||
rocksdb' = rocksdb.override {
|
rocksdb' = rocksdb.override {
|
||||||
enableJemalloc = builtins.elem "jemalloc" features;
|
enableJemalloc = builtins.elem "jemalloc" features;
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
CONDUIT_VERSION_EXTRA =
|
|
||||||
inputs.self.shortRev or inputs.self.dirtyShortRev;
|
|
||||||
ROCKSDB_INCLUDE_DIR = "${rocksdb'}/include";
|
ROCKSDB_INCLUDE_DIR = "${rocksdb'}/include";
|
||||||
ROCKSDB_LIB_DIR = "${rocksdb'}/lib";
|
ROCKSDB_LIB_DIR = "${rocksdb'}/lib";
|
||||||
}
|
}
|
||||||
|
@ -35,26 +33,45 @@ let
|
||||||
rust
|
rust
|
||||||
stdenv;
|
stdenv;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
buildPackageEnv = {
|
||||||
|
CONDUIT_VERSION_EXTRA = inputs.self.shortRev or inputs.self.dirtyShortRev;
|
||||||
|
} // buildDepsOnlyEnv;
|
||||||
|
|
||||||
|
commonAttrs = {
|
||||||
|
inherit
|
||||||
|
(craneLib.crateNameFromCargoToml {
|
||||||
|
cargoToml = "${inputs.self}/Cargo.toml";
|
||||||
|
})
|
||||||
|
pname
|
||||||
|
version;
|
||||||
|
|
||||||
|
src = let filter = inputs.nix-filter.lib; in filter {
|
||||||
|
root = inputs.self;
|
||||||
|
|
||||||
|
# Keep sorted
|
||||||
|
include = [
|
||||||
|
"Cargo.lock"
|
||||||
|
"Cargo.toml"
|
||||||
|
"src"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
nativeBuildInputs = [
|
||||||
|
# bindgen needs the build platform's libclang. Apparently due to "splicing
|
||||||
|
# weirdness", pkgs.rustPlatform.bindgenHook on its own doesn't quite do the
|
||||||
|
# right thing here.
|
||||||
|
pkgsBuildHost.rustPlatform.bindgenHook
|
||||||
|
];
|
||||||
|
|
||||||
|
CARGO_PROFILE = profile;
|
||||||
|
};
|
||||||
in
|
in
|
||||||
|
|
||||||
craneLib.buildPackage rec {
|
craneLib.buildPackage ( commonAttrs // {
|
||||||
inherit
|
cargoArtifacts = craneLib.buildDepsOnly (commonAttrs // {
|
||||||
(craneLib.crateNameFromCargoToml {
|
env = buildDepsOnlyEnv;
|
||||||
cargoToml = "${inputs.self}/Cargo.toml";
|
});
|
||||||
})
|
|
||||||
pname
|
|
||||||
version;
|
|
||||||
|
|
||||||
src = let filter = inputs.nix-filter.lib; in filter {
|
|
||||||
root = inputs.self;
|
|
||||||
|
|
||||||
# Keep sorted
|
|
||||||
include = [
|
|
||||||
"Cargo.lock"
|
|
||||||
"Cargo.toml"
|
|
||||||
"src"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
cargoExtraArgs = "--locked "
|
cargoExtraArgs = "--locked "
|
||||||
+ lib.optionalString
|
+ lib.optionalString
|
||||||
|
@ -67,20 +84,11 @@ craneLib.buildPackage rec {
|
||||||
# This is redundant with CI
|
# This is redundant with CI
|
||||||
doCheck = false;
|
doCheck = false;
|
||||||
|
|
||||||
nativeBuildInputs = [
|
env = buildPackageEnv;
|
||||||
# bindgen needs the build platform's libclang. Apparently due to "splicing
|
|
||||||
# weirdness", pkgs.rustPlatform.bindgenHook on its own doesn't quite do the
|
|
||||||
# right thing here.
|
|
||||||
pkgsBuildHost.rustPlatform.bindgenHook
|
|
||||||
];
|
|
||||||
|
|
||||||
CARGO_PROFILE = profile;
|
|
||||||
|
|
||||||
inherit env;
|
|
||||||
|
|
||||||
passthru = {
|
passthru = {
|
||||||
inherit env;
|
env = buildPackageEnv;
|
||||||
};
|
};
|
||||||
|
|
||||||
meta.mainProgram = pname;
|
meta.mainProgram = commonAttrs.pname;
|
||||||
}
|
})
|
||||||
|
|
Loading…
Reference in a new issue