Build Cloud services with Nix. (#1019)

Changes to the Nix build to support Hasura cloud services.

V3_GIT_ORIGIN_REV_ID: 39fc7e0a005c30ed6ecbfed8dbcd0cd3839aafbd
This commit is contained in:
Samir Talwar 2024-08-27 11:03:22 +02:00 committed by hasura-bot
parent 43daeffcca
commit 288c973ac7
2 changed files with 8 additions and 3 deletions

View File

@ -45,6 +45,9 @@
"dev-auth-webhook"
];
binaryPackages = {
};
defaultBinary = "engine";
dockerConfig = {
@ -107,6 +110,7 @@
binary = rust.${targetSystem}.callPackage ./nix/app.nix {
inherit version;
pname = binaryName;
packageName = binaryPackages.${binaryName} or binaryName;
};
docker =
if dockerArchitectures ? ${targetSystem}
@ -116,7 +120,7 @@
package = self.targets.${localSystem}.${binaryName}.${targetSystem}.binary;
architecture = dockerArchitectures.${targetSystem};
image-name = "build.internal/${binaryName}-${targetSystem}";
extraConfig = dockerConfig.${binaryName};
extraConfig = dockerConfig.${binaryName} or { };
}
else null;
})

View File

@ -9,6 +9,7 @@
, protobuf
, darwin
, pname
, packageName ? pname
}:
let
buildArgs = {
@ -42,13 +43,13 @@ let
};
# only build the binary we care about
cargoExtraArgs = "--package ${buildArgs.pname}";
cargoExtraArgs = "--package ${packageName}";
# 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}";
buildPhaseCargoCommand = "cargo build --profile $CARGO_PROFILE --package ${packageName}";
doCheck = false;
}