87 lines
2.7 KiB
Nix
87 lines
2.7 KiB
Nix
{ pkgs ? import <nixpkgs> {} }:
|
|
|
|
let
|
|
# Updating this package will force an update for nodePackages.prisma. The
|
|
# version of prisma-engines and nodePackages.prisma must be the same for them to
|
|
# function correctly.
|
|
prisma-version = "5.7.1";
|
|
prisma-src = pkgs.fetchFromGitHub {
|
|
owner = "prisma";
|
|
repo = "prisma-engines";
|
|
rev = prisma-version;
|
|
hash = "sha256-EOYbWUgoc/9uUtuocfWDh0elExzL0+wb4PsihgMbsWs=";
|
|
};
|
|
new-prisma-engines = pkgs.rustPlatform.buildRustPackage {
|
|
pname = "prisma-engines";
|
|
version = prisma-version;
|
|
|
|
src = builtins.storePath prisma-src;
|
|
|
|
# Use system openssl.
|
|
OPENSSL_NO_VENDOR = 1;
|
|
|
|
nativeBuildInputs = [ pkgs.pkg-config pkgs.git ];
|
|
|
|
buildInputs = [
|
|
pkgs.openssl
|
|
pkgs.protobuf
|
|
];
|
|
|
|
cargoLock = {
|
|
lockFile = "${prisma-src}/Cargo.lock";
|
|
outputHashes = {
|
|
"cuid-1.3.2" = "sha256-ZihFrLerEIOdbJggaBbByRbC1sZRvF4M0LN2albB7vA=";
|
|
"barrel-0.6.6-alpha.0" = "sha256-USh0lQ1z+3Spgc69bRFySUzhuY79qprLlEExTmYWFN8=";
|
|
"graphql-parser-0.3.0" = "sha256-0ZAsj2mW6fCLhwTETucjbu4rPNzfbNiHu2wVTBlTNe4=";
|
|
"mysql_async-0.31.3" = "sha256-QIO9s0Upc0/1W7ux1RNJNGKqzO4gB4gMV3NoakAbxkQ=";
|
|
"postgres-native-tls-0.5.0" = "sha256-UYPsxhCkXXWk8yPbqjNS0illwjS5mVm3Z/jFwpVwqfw=";
|
|
};
|
|
};
|
|
|
|
preBuild = ''
|
|
export OPENSSL_DIR=${pkgs.lib.getDev pkgs.openssl}
|
|
export OPENSSL_LIB_DIR=${pkgs.lib.getLib pkgs.openssl}/lib
|
|
|
|
export PROTOC=${pkgs.protobuf}/bin/protoc
|
|
export PROTOC_INCLUDE="${pkgs.protobuf}/include";
|
|
|
|
export SQLITE_MAX_VARIABLE_NUMBER=250000
|
|
export SQLITE_MAX_EXPR_DEPTH=10000
|
|
'';
|
|
|
|
cargoBuildFlags = [
|
|
"-p" "query-engine"
|
|
"-p" "query-engine-node-api"
|
|
"-p" "schema-engine-cli"
|
|
"-p" "prisma-fmt"
|
|
];
|
|
|
|
postInstall = ''
|
|
mv $out/lib/libquery_engine${pkgs.stdenv.hostPlatform.extensions.sharedLibrary} $out/lib/libquery_engine.node
|
|
'';
|
|
|
|
# Tests are long to compile
|
|
doCheck = false;
|
|
|
|
# meta = with lib; {
|
|
# description = "A collection of engines that power the core stack for Prisma";
|
|
# homepage = "https://www.prisma.io/";
|
|
# license = licenses.asl20;
|
|
# platforms = platforms.unix;
|
|
# maintainers = with maintainers; [ pimeys tomhoule ivan aqrln ];
|
|
# };
|
|
};
|
|
in
|
|
pkgs.mkShell {
|
|
nativeBuildInputs = [
|
|
new-prisma-engines
|
|
pkgs.nodejs_18
|
|
pkgs.openssl
|
|
];
|
|
shellHook = ''
|
|
export PRISMA_SCHEMA_ENGINE_BINARY="${new-prisma-engines}/bin/schema-engine"
|
|
export PRISMA_QUERY_ENGINE_BINARY="${new-prisma-engines}/bin/query-engine"
|
|
export PRISMA_QUERY_ENGINE_LIBRARY="${new-prisma-engines}/lib/libquery_engine.node"
|
|
export PRISMA_FMT_BINARY="${new-prisma-engines}/bin/prisma-fmt"
|
|
'';
|
|
}
|