|
Hi, I'm trying to run prisma on NixOS and as there are no precompiled binaries I compiled them myself: with import <nixpkgs> {};
stdenv.mkDerivation {
name = "abc-dev-environment";
buildInputs = [ pkg-config zlib openssl nodejs ];
}nix-shell
git clone https://github.com/prisma/prisma-engines/
cd prisma-engines
source .envrc
cargo build --release
cd ..
export PRISMA_MIGRATION_ENGINE_BINARY=$PWD/prisma-engines/target/release/migration-engine
export PRISMA_INTROSPECTION_ENGINE_BINARY=$PWD/prisma-engines/target/release/introspection-engine
export PRISMA_QUERY_ENGINE_BINARY=$PWD/prisma-engines/target/release/query-engine
export PRISMA_FMT_BINARY=$PWD/prisma-engines/target/release/prisma-fmt
yarn prisma migrate save --experimentalResponse: Any ideas? Any help is really appreciated. P.S.: I'm a starter with NixOS - previously I used ArchLinux |
Replies: 4 comments 9 replies
|
I think I got it fixed now. Specifically setting the environment variables breaks it, you just need to copy the files to the correct location. Full instructions for future reference: setup-nix.sh #! /usr/bin/env nix-shell
#! nix-shell -i bash -p pkg-config zlib openssl nodejs cargo
#yarn # install all packages, so the node_modules folder is available
git clone https://github.com/prisma/prisma-engines/
cd prisma-engines
source .envrc # idk if needed
cargo build --release
cd ..
cp prisma-engines/target/release/introspection-engine node_modules/@prisma/cli/introspection-engine-linux-nixos
cp prisma-engines/target/release/migration-engine node_modules/@prisma/cli/migration-engine-linux-nixos
cp prisma-engines/target/release/query-engine node_modules/@prisma/cli/query-engine-linux-nixos
cp prisma-engines/target/release/prisma-fmt node_modules/@prisma/cli/prisma-fmt-linux-nixos
cp prisma-engines/target/release/introspection-engine node_modules/@prisma/sdk/introspection-engine-linux-nixos
cp prisma-engines/target/release/migration-engine node_modules/@prisma/sdk/migration-engine-linux-nixos
cp prisma-engines/target/release/query-engine node_modules/@prisma/sdk/query-engine-linux-nixos
cp prisma-engines/target/release/prisma-fmt node_modules/@prisma/sdk/prisma-fmt-linux-nixos |
|
Awesome! Thanks guys, so in the end now i have system wide { config
, lib
, pkgs
, ...
}: {
environment.systemPackages = with pkgs; [
# For Prisma:
nodePackages_latest.pnpm
nodePackages_latest.vercel
nodePackages_latest.prisma
openssl
nodejs_21
# Also dont forget to add install postgresql with configuration in some other config file
];
# Prisma:
environment.variables.PRISMA_QUERY_ENGINE_LIBRARY = "${pkgs.prisma-engines}/lib/libquery_engine.node";
environment.variables.PRISMA_QUERY_ENGINE_BINARY = "${pkgs.prisma-engines}/bin/query-engine";
environment.variables.PRISMA_SCHEMA_ENGINE_BINARY = "${pkgs.prisma-engines}/bin/schema-engine";
}just put in in your nix/flake system wide config and dont forget to install postgresql |
|
Hi there, To keep our discussions organized and focused on the most relevant topics, we’re reviewing and tidying up our backlog. As part of this process, we’re closing discussions that have already been marked as answered but remain open. If this discussion still requires further input or clarification, feel free to reopen it or start a new one with updated details. Your contributions are invaluable to the community, and we’re here to help! For more details about our priorities and vision for the future of Prisma ORM, check out our latest blog post: https://www.prisma.io/blog/prisma-orm-manifesto. Thank you for your understanding and ongoing support of the Prisma community! |
I think I got it fixed now. Specifically setting the environment variables breaks it, you just need to copy the files to the correct location. Full instructions for future reference:
setup-nix.sh