graphql-engine/v3/flake.nix
Samir Talwar e931a391eb Various improvements to the Docker Compose services. (#383)
I got frustrated by the lack of useful output when services failed to
start in CI, so I thought I'd mess around.

I made some changes so that:

1. we wait for services with health checks to report as healthy,
2. we do not rebuild the engine or custom connector when they start,
3. the health checks work (apart from ndc-postgres, which will come
later), and
4. we use environment variables rather than command-line arguments where
possible.

I have also renamed the "agent" binary to "custom-connector", matching
its crate, because it was driving me a little crazy.

V3_GIT_ORIGIN_REV_ID: 8d672b0b25438b54d47368ce82cd236cfdd4e554
2024-03-21 16:49:38 +00:00

82 lines
2.1 KiB
Nix

{
description = "DDN Engine";
inputs = {
nixpkgs.url = github:NixOS/nixpkgs/nixos-unstable;
flake-utils.url = github:numtide/flake-utils;
crane = {
url = "github:ipetkov/crane";
inputs.nixpkgs.follows = "nixpkgs";
};
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs = {
nixpkgs.follows = "nixpkgs";
flake-utils.follows = "flake-utils";
};
};
};
outputs = { self, nixpkgs, flake-utils, crane, rust-overlay }:
flake-utils.lib.eachDefaultSystem (localSystem:
let
pkgs = import nixpkgs {
system = localSystem;
overlays = [ rust-overlay.overlays.default ];
};
rust = import ./nix/rust.nix {
inherit nixpkgs rust-overlay crane localSystem;
};
in
{
formatter = pkgs.nixpkgs-fmt;
packages = {
# a binary for whichever is the local computer
default = rust.callPackage ./nix/app.nix {
version = if self ? "dirtyRev" then self.dirtyShortRev else self.shortRev;
};
};
apps = {
default = self.apps.${localSystem}.engine;
engine = flake-utils.lib.mkApp {
drv = self.packages.${localSystem}.default;
name = "engine";
};
custom-connector = flake-utils.lib.mkApp {
drv = self.packages.${localSystem}.default;
name = "custom-connector";
};
};
devShells = {
default = pkgs.mkShell {
# include dependencies of the default package
inputsFrom = [ self.packages.${localSystem}.default ];
# build-time inputs
nativeBuildInputs = [
# Development
pkgs.just
pkgs.nixpkgs-fmt
# Rust
pkgs.cargo-edit
pkgs.cargo-expand
pkgs.cargo-flamegraph
pkgs.cargo-insta
pkgs.cargo-machete
pkgs.cargo-nextest
pkgs.cargo-watch
pkgs.rnix-lsp
rust.rustToolchain
];
};
};
});
}