2024-03-06 14:38:27 +03:00
|
|
|
{
|
|
|
|
description = "DDN Engine";
|
|
|
|
|
|
|
|
inputs = {
|
2024-06-04 17:14:54 +03:00
|
|
|
nixpkgs.url = "github:NixOS/nixpkgs";
|
|
|
|
flake-utils.url = "github:numtide/flake-utils";
|
2024-03-06 14:38:27 +03:00
|
|
|
|
|
|
|
crane = {
|
|
|
|
url = "github:ipetkov/crane";
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
};
|
|
|
|
|
|
|
|
rust-overlay = {
|
|
|
|
url = "github:oxalica/rust-overlay";
|
|
|
|
inputs = {
|
|
|
|
nixpkgs.follows = "nixpkgs";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
outputs = { self, nixpkgs, flake-utils, crane, rust-overlay }:
|
2024-04-26 11:43:19 +03:00
|
|
|
flake-utils.lib.eachDefaultSystem
|
|
|
|
(localSystem:
|
|
|
|
let
|
2024-06-05 11:20:02 +03:00
|
|
|
version = pkgs.lib.strings.fileContents ./nix/version;
|
|
|
|
|
2024-04-26 11:43:19 +03:00
|
|
|
pkgs = import nixpkgs {
|
|
|
|
system = localSystem;
|
|
|
|
overlays = [ rust-overlay.overlays.default ];
|
2024-03-06 20:50:32 +03:00
|
|
|
};
|
|
|
|
|
2024-04-26 11:43:19 +03:00
|
|
|
rust = import ./nix/rust.nix {
|
|
|
|
inherit nixpkgs rust-overlay crane localSystem;
|
2024-03-06 20:50:32 +03:00
|
|
|
};
|
2024-04-26 11:43:19 +03:00
|
|
|
|
|
|
|
rust-x86_64-linux = (import ./nix/rust.nix {
|
|
|
|
inherit nixpkgs rust-overlay crane localSystem;
|
|
|
|
crossSystem = "x86_64-linux";
|
|
|
|
});
|
|
|
|
|
|
|
|
rust-aarch64-linux = (import ./nix/rust.nix {
|
|
|
|
inherit nixpkgs rust-overlay crane localSystem;
|
|
|
|
crossSystem = "aarch64-linux";
|
|
|
|
});
|
|
|
|
in
|
|
|
|
{
|
|
|
|
formatter = pkgs.nixpkgs-fmt;
|
|
|
|
|
|
|
|
packages = {
|
2024-06-04 17:14:54 +03:00
|
|
|
###### ENGINE
|
|
|
|
|
|
|
|
# engine binary for whichever is the local machine
|
|
|
|
engine = rust.callPackage ./nix/app.nix {
|
2024-06-05 11:20:02 +03:00
|
|
|
inherit version;
|
2024-06-04 17:14:54 +03:00
|
|
|
pname = "engine";
|
|
|
|
};
|
|
|
|
|
|
|
|
# engine binary for x86_64-linux
|
|
|
|
engine-x86_64-linux = rust-x86_64-linux.callPackage ./nix/app.nix {
|
2024-06-05 11:20:02 +03:00
|
|
|
inherit version;
|
2024-06-04 17:14:54 +03:00
|
|
|
pname = "engine";
|
|
|
|
};
|
|
|
|
|
|
|
|
# engine binary for aarch64-linux
|
|
|
|
engine-aarch64-linux = rust-aarch64-linux.callPackage ./nix/app.nix {
|
2024-06-05 11:20:02 +03:00
|
|
|
inherit version;
|
2024-06-04 17:14:54 +03:00
|
|
|
pname = "engine";
|
|
|
|
};
|
|
|
|
|
|
|
|
# engine docker files for whichever is the local machine
|
|
|
|
engine-docker = pkgs.callPackage ./nix/docker.nix {
|
|
|
|
package = self.packages.${localSystem}.engine;
|
|
|
|
image-name = "ghcr.io/hasura/v3-engine";
|
|
|
|
tag = "dev";
|
|
|
|
port = "3000";
|
|
|
|
};
|
|
|
|
|
|
|
|
# engine docker for x86_64-linux
|
|
|
|
engine-docker-x86_64-linux = pkgs.callPackage ./nix/docker.nix {
|
|
|
|
package = self.packages.${localSystem}.engine-x86_64-linux;
|
|
|
|
architecture = "amd64";
|
|
|
|
image-name = "ghcr.io/hasura/v3-engine";
|
|
|
|
port = "3000";
|
|
|
|
};
|
|
|
|
|
|
|
|
# engine docker for aarch64-linux
|
|
|
|
engine-docker-aarch64-linux = pkgs.callPackage ./nix/docker.nix {
|
|
|
|
package = self.packages.${localSystem}.engine-aarch64-linux;
|
|
|
|
architecture = "arm64";
|
|
|
|
image-name = "ghcr.io/hasura/v3-engine";
|
|
|
|
port = "3000";
|
|
|
|
};
|
|
|
|
|
|
|
|
default = self.packages.${localSystem}.engine;
|
2024-04-26 11:43:19 +03:00
|
|
|
|
|
|
|
###### CUSTOM_CONNECTOR
|
|
|
|
|
|
|
|
# custom-connector binary for whichever is the local machine
|
|
|
|
custom-connector = rust.callPackage ./nix/app.nix {
|
2024-06-05 11:20:02 +03:00
|
|
|
inherit version;
|
2024-04-26 11:43:19 +03:00
|
|
|
pname = "custom-connector";
|
|
|
|
};
|
|
|
|
|
|
|
|
# custom-connector binary for x86_64-linux
|
2024-06-04 17:14:54 +03:00
|
|
|
custom-connector-x86_64-linux = rust-x86_64-linux.callPackage ./nix/app.nix {
|
2024-06-05 11:20:02 +03:00
|
|
|
inherit version;
|
2024-06-04 17:14:54 +03:00
|
|
|
pname = "custom-connector";
|
|
|
|
};
|
2024-04-26 11:43:19 +03:00
|
|
|
|
2024-06-04 17:14:54 +03:00
|
|
|
# custom-connector binary for aarch64-linux
|
|
|
|
custom-connector-aarch64-linux = rust-aarch64-linux.callPackage ./nix/app.nix {
|
2024-06-05 11:20:02 +03:00
|
|
|
inherit version;
|
2024-06-04 17:14:54 +03:00
|
|
|
pname = "custom-connector";
|
|
|
|
};
|
2024-04-26 11:43:19 +03:00
|
|
|
|
|
|
|
# custom-connector docker files for whichever is the local machine
|
|
|
|
custom-connector-docker = pkgs.callPackage ./nix/docker.nix {
|
|
|
|
package = self.packages.${localSystem}.custom-connector;
|
|
|
|
image-name = "ghcr.io/hasura/v3-custom-connector";
|
|
|
|
tag = "dev";
|
|
|
|
port = "8181";
|
|
|
|
};
|
|
|
|
|
|
|
|
# custom-connector docker for x86_64-linux
|
|
|
|
custom-connector-docker-x86_64-linux = pkgs.callPackage ./nix/docker.nix {
|
|
|
|
package = self.packages.${localSystem}.custom-connector-x86_64-linux;
|
|
|
|
architecture = "amd64";
|
|
|
|
image-name = "ghcr.io/hasura/v3-custom-connector";
|
|
|
|
port = "8181";
|
|
|
|
};
|
|
|
|
|
|
|
|
# custom-connector docker for aarch64-linux
|
|
|
|
custom-connector-docker-aarch64-linux = pkgs.callPackage ./nix/docker.nix {
|
|
|
|
package = self.packages.${localSystem}.custom-connector-aarch64-linux;
|
|
|
|
architecture = "arm64";
|
|
|
|
image-name = "ghcr.io/hasura/v3-custom-connector";
|
|
|
|
port = "8181";
|
|
|
|
};
|
|
|
|
|
2024-05-02 17:22:44 +03:00
|
|
|
###### DEV-AUTH-WEBHOOK
|
|
|
|
|
|
|
|
# dev-auth-webhook binary for whichever is the local machine
|
|
|
|
dev-auth-webhook = rust.callPackage ./nix/app.nix {
|
2024-06-05 11:20:02 +03:00
|
|
|
inherit version;
|
2024-05-02 17:22:44 +03:00
|
|
|
pname = "dev-auth-webhook";
|
|
|
|
};
|
|
|
|
|
|
|
|
# dev-auth-webhook binary for x86_64-linux
|
2024-06-04 17:14:54 +03:00
|
|
|
dev-auth-webhook-x86_64-linux = rust-x86_64-linux.callPackage ./nix/app.nix {
|
2024-06-05 11:20:02 +03:00
|
|
|
inherit version;
|
2024-06-04 17:14:54 +03:00
|
|
|
pname = "dev-auth-webhook";
|
|
|
|
};
|
2024-05-02 17:22:44 +03:00
|
|
|
|
2024-06-04 17:14:54 +03:00
|
|
|
# dev-auth-webhook binary for aarch64-linux
|
|
|
|
dev-auth-webhook-aarch64-linux = rust-aarch64-linux.callPackage ./nix/app.nix {
|
2024-06-05 11:20:02 +03:00
|
|
|
inherit version;
|
2024-06-04 17:14:54 +03:00
|
|
|
pname = "dev-auth-webhook";
|
|
|
|
};
|
2024-05-02 17:22:44 +03:00
|
|
|
|
|
|
|
# dev-auth-webhook docker files for whichever is the local machine
|
|
|
|
dev-auth-webhook-docker = pkgs.callPackage ./nix/docker.nix {
|
|
|
|
package = self.packages.${localSystem}.dev-auth-webhook;
|
|
|
|
image-name = "ghcr.io/hasura/v3-dev-auth-webhook";
|
|
|
|
tag = "dev";
|
|
|
|
port = "3050";
|
|
|
|
};
|
|
|
|
|
|
|
|
# dev-auth-webhook docker for x86_64-linux
|
|
|
|
dev-auth-webhook-docker-x86_64-linux = pkgs.callPackage ./nix/docker.nix {
|
|
|
|
package = self.packages.${localSystem}.dev-auth-webhook-x86_64-linux;
|
|
|
|
architecture = "amd64";
|
|
|
|
image-name = "ghcr.io/hasura/v3-dev-auth-webhook";
|
|
|
|
port = "3050";
|
|
|
|
};
|
|
|
|
|
|
|
|
# dev-auth-webhook docker for aarch64-linux
|
|
|
|
dev-auth-webhook-docker-aarch64-linux = pkgs.callPackage ./nix/docker.nix {
|
|
|
|
package = self.packages.${localSystem}.dev-auth-webhook-aarch64-linux;
|
|
|
|
architecture = "arm64";
|
|
|
|
image-name = "ghcr.io/hasura/v3-dev-auth-webhook";
|
|
|
|
port = "3050";
|
|
|
|
};
|
2024-04-26 11:43:19 +03:00
|
|
|
|
2024-06-04 17:14:54 +03:00
|
|
|
### SCRIPTS
|
2024-04-26 11:43:19 +03:00
|
|
|
|
2024-06-04 17:14:54 +03:00
|
|
|
publish-docker-image = pkgs.writeShellApplication {
|
|
|
|
name = "publish-docker-image";
|
|
|
|
runtimeInputs = with pkgs; [ coreutils skopeo ];
|
|
|
|
text = builtins.readFile ./.github/scripts/deploy.sh;
|
2024-04-26 11:43:19 +03:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
apps = {
|
|
|
|
default = self.apps.${localSystem}.engine;
|
|
|
|
engine = flake-utils.lib.mkApp {
|
|
|
|
drv = self.packages.${localSystem}.engine;
|
|
|
|
name = "engine";
|
|
|
|
};
|
2024-05-02 17:22:44 +03:00
|
|
|
dev-auth-webhook = flake-utils.lib.mkApp {
|
|
|
|
drv = self.packages.${localSystem}.dev-auth-webhook;
|
|
|
|
name = "dev-auth-webhook";
|
|
|
|
};
|
2024-04-26 11:43:19 +03:00
|
|
|
custom-connector = flake-utils.lib.mkApp {
|
|
|
|
drv = self.packages.${localSystem}.custom-connector;
|
|
|
|
name = "custom-connector";
|
|
|
|
};
|
2024-03-06 20:50:32 +03:00
|
|
|
};
|
2024-04-26 11:43:19 +03:00
|
|
|
|
|
|
|
devShells = {
|
|
|
|
default = pkgs.mkShell {
|
|
|
|
# include dependencies of the default package
|
|
|
|
inputsFrom = [ self.packages.${localSystem}.default ];
|
|
|
|
|
|
|
|
# build-time inputs
|
|
|
|
nativeBuildInputs = [
|
|
|
|
# Development
|
|
|
|
pkgs.just
|
2024-07-11 17:15:12 +03:00
|
|
|
pkgs.moreutils
|
2024-04-26 11:43:19 +03:00
|
|
|
pkgs.nixpkgs-fmt
|
Format everything with Prettier. (#530)
I found myself wanting to rewrite JSON files with `sed`. The problem is,
then I want to run a formatter over them afterwards, and this will
change the whole file, not just the area I touched.
I would like to propose the nuclear option in remedying this: format
everything now. This is a very large change that should make it easier
to keep files to a consistent format in the future.
I have chosen to use Prettier for this because (a) it has a useful
`--write` command and (b) it also does GraphQL, Markdown, YAML, etc.
I've elected to exclude two sets of files:
1. `crates/custom-connector/data/*.json`, because they are actually
multiple JSON objects, one per line, which Prettier cannot parse.
2. `crates/lang-graphql/tests/**/*.graphql`, because it contains invalid
GraphQL, and the parser is intended to work with strangely-formatted
GraphQL.
The main changes are standardizing whitespace, adding a newline at the
end of files, and putting JSON arrays on one line when they fit.
V3_GIT_ORIGIN_REV_ID: 92d4a535c34a3cc00721e8ddc6f17c5717e8ff76
2024-04-30 17:58:09 +03:00
|
|
|
pkgs.nodePackages.prettier
|
2024-04-26 11:43:19 +03:00
|
|
|
|
|
|
|
# Rust
|
2024-06-11 18:32:43 +03:00
|
|
|
pkgs.bacon
|
2024-04-26 11:43:19 +03:00
|
|
|
pkgs.cargo-edit
|
|
|
|
pkgs.cargo-expand
|
|
|
|
pkgs.cargo-flamegraph
|
|
|
|
pkgs.cargo-insta
|
|
|
|
pkgs.cargo-machete
|
|
|
|
pkgs.cargo-nextest
|
|
|
|
pkgs.cargo-watch
|
|
|
|
rust.rustToolchain
|
|
|
|
];
|
|
|
|
};
|
2024-03-06 14:38:27 +03:00
|
|
|
};
|
2024-04-26 11:43:19 +03:00
|
|
|
});
|
2024-03-06 14:38:27 +03:00
|
|
|
}
|