From 288c973ac7a350d4c32ac2e56707049412eaaa73 Mon Sep 17 00:00:00 2001 From: Samir Talwar Date: Tue, 27 Aug 2024 11:03:22 +0200 Subject: [PATCH] Build Cloud services with Nix. (#1019) Changes to the Nix build to support Hasura cloud services. V3_GIT_ORIGIN_REV_ID: 39fc7e0a005c30ed6ecbfed8dbcd0cd3839aafbd --- v3/flake.nix | 6 +++++- v3/nix/app.nix | 5 +++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/v3/flake.nix b/v3/flake.nix index 7e745d41261..5c894a8b312 100644 --- a/v3/flake.nix +++ b/v3/flake.nix @@ -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; }) diff --git a/v3/nix/app.nix b/v3/nix/app.nix index 11416dca76e..844a0c5fccf 100644 --- a/v3/nix/app.nix +++ b/v3/nix/app.nix @@ -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; }