nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at 22.05 76 lines 2.8 kB view raw
1{ fetchFromGitHub 2, lib 3, Security 4, openssl 5, pkg-config 6, protobuf 7, rustPlatform 8, stdenv 9}: 10 11# Updating this package will force an update for nodePackages.prisma. The 12# version of prisma-engines and nodePackages.prisma must be the same for them to 13# function correctly. 14rustPlatform.buildRustPackage rec { 15 pname = "prisma-engines"; 16 version = "3.14.0"; 17 18 src = fetchFromGitHub { 19 owner = "prisma"; 20 repo = "prisma-engines"; 21 rev = version; 22 sha256 = "sha256-UawQbVbafRpxkYFGW+y+HkkYME8qziG7tmsIjbqwHq0="; 23 }; 24 25 # Use system openssl. 26 OPENSSL_NO_VENDOR = 1; 27 28 cargoSha256 = "sha256-1kR70t7vWzvV3DOrkVP6ktzKK5tB9KjJyAMpKO6gtYA="; 29 30 nativeBuildInputs = [ pkg-config ]; 31 32 buildInputs = [ 33 openssl 34 protobuf 35 ] ++ lib.optionals stdenv.isDarwin [ Security ]; 36 37 preBuild = '' 38 export OPENSSL_DIR=${lib.getDev openssl} 39 export OPENSSL_LIB_DIR=${lib.getLib openssl}/lib 40 41 export PROTOC=${protobuf}/bin/protoc 42 export PROTOC_INCLUDE="${protobuf}/include"; 43 44 export SQLITE_MAX_VARIABLE_NUMBER=250000 45 export SQLITE_MAX_EXPR_DEPTH=10000 46 ''; 47 48 cargoBuildFlags = "-p query-engine -p query-engine-node-api -p migration-engine-cli -p introspection-core -p prisma-fmt"; 49 50 postInstall = '' 51 mv $out/lib/libquery_engine${stdenv.hostPlatform.extensions.sharedLibrary} $out/lib/libquery_engine.node 52 ''; 53 54 # Tests are long to compile 55 doCheck = false; 56 57 meta = with lib; { 58 description = "A collection of engines that power the core stack for Prisma"; 59 homepage = "https://www.prisma.io/"; 60 license = licenses.asl20; 61 platforms = platforms.unix; 62 maintainers = with maintainers; [ pamplemousse pimeys superherointj ]; 63 }; 64} 65 66### Troubleshooting 67# Here's an example application using Prisma with Nix: https://github.com/pimeys/nix-prisma-example 68# At example's `flake.nix` shellHook, notice the requirement of defining environment variables for prisma, it's values will show on `prisma --version`. 69# Read the example's README: https://github.com/pimeys/nix-prisma-example/blob/main/README.md 70# Prisma requires 2 packages, `prisma-engines` and `nodePackages.prisma`, to be at *exact* same versions. 71# Certify at `package.json` that dependencies "@prisma/client" and "prisma" are equal, meaning no caret (`^`) in version. 72# Configure NPM to use exact version: `npm config set save-exact=true` 73# Delete `package-lock.json`, delete `node_modules` directory and run `npm install`. 74# Run prisma client from `node_modules/.bin/prisma`. 75# 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. 76# Test prisma with `generate`, `db push`, etc. It should work. If not, open an issue.