12 # Updating this package will force an update for nodePackages.prisma. The
13 # version of prisma-engines and nodePackages.prisma must be the same for them to
15 rustPlatform.buildRustPackage rec {
16 pname = "prisma-engines";
19 src = fetchFromGitHub {
21 repo = "prisma-engines";
23 hash = "sha256-emy2Qvx05D8omSc3Ivx66EnThW/tr77UGQu3qhat/fc=";
27 OPENSSL_NO_VENDOR = 1;
30 lockFile = ./Cargo.lock;
32 "barrel-0.6.6-alpha.0" = "sha256-USh0lQ1z+3Spgc69bRFySUzhuY79qprLlEExTmYWFN8=";
33 "cuid-1.3.2" = "sha256-qBu1k/dJiA6rWBwk4nOOqouIneD9h2TTBT8tvs0TDfA=";
34 "graphql-parser-0.3.0" = "sha256-0ZAsj2mW6fCLhwTETucjbu4rPNzfbNiHu2wVTBlTNe4=";
35 "mysql_async-0.31.3" = "sha256-2wOupQ/LFV9pUifqBLwTvA0tySv+XWbxHiqs7iTzvvg=";
36 "postgres-native-tls-0.5.0" = "sha256-UYPsxhCkXXWk8yPbqjNS0illwjS5mVm3Z/jFwpVwqfw=";
40 nativeBuildInputs = [ pkg-config git ];
45 ] ++ lib.optionals stdenv.isDarwin [ Security ];
48 export OPENSSL_DIR=${lib.getDev openssl}
49 export OPENSSL_LIB_DIR=${lib.getLib openssl}/lib
51 export PROTOC=${protobuf}/bin/protoc
52 export PROTOC_INCLUDE="${protobuf}/include";
54 export SQLITE_MAX_VARIABLE_NUMBER=250000
55 export SQLITE_MAX_EXPR_DEPTH=10000
60 "-p" "query-engine-node-api"
61 "-p" "schema-engine-cli"
66 mv $out/lib/libquery_engine${stdenv.hostPlatform.extensions.sharedLibrary} $out/lib/libquery_engine.node
69 # Tests are long to compile
73 description = "A collection of engines that power the core stack for Prisma";
74 homepage = "https://www.prisma.io/";
75 license = licenses.asl20;
76 platforms = platforms.unix;
77 maintainers = with maintainers; [ pimeys tomhoule ivan aqrln ];
82 # Here's an example application using Prisma with Nix: https://github.com/pimeys/nix-prisma-example
83 # At example's `flake.nix` shellHook, notice the requirement of defining environment variables for prisma, it's values will show on `prisma --version`.
84 # Read the example's README: https://github.com/pimeys/nix-prisma-example/blob/main/README.md
85 # Prisma requires 2 packages, `prisma-engines` and `nodePackages.prisma`, to be at *exact* same versions.
86 # Certify at `package.json` that dependencies "@prisma/client" and "prisma" are equal, meaning no caret (`^`) in version.
87 # Configure NPM to use exact version: `npm config set save-exact=true`
88 # Delete `package-lock.json`, delete `node_modules` directory and run `npm install`.
89 # Run prisma client from `node_modules/.bin/prisma`.
90 # Run `./node_modules/.bin/prisma --version` and check if both prisma packages versions are equal, current platform is `linux-nixos`, and other keys equal to the prisma environment variables you defined for prisma.
91 # Test prisma with `generate`, `db push`, etc. It should work. If not, open an issue.