Prisma in nixos devshell

{
  description = "HoogleDrive";

  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
  };

  outputs =
    { self, nixpkgs }:
    let
      system = "x86_64-linux";
      pkgs = nixpkgs.legacyPackages.${system};
    in
    {
      devShells.${system}.default = pkgs.mkShell {
        packages = with pkgs; [
          nodejs_24
          openssl
          prisma-engines
          prisma
        ];

        shellHook = ''
          export PKG_CONFIG_PATH="${pkgs.openssl.dev}/lib/pkgconfig"
          export PRISMA_SCHEMA_ENGINE_BINARY="${pkgs.prisma-engines}/bin/schema-engine"
          export PRISMA_QUERY_ENGINE_BINARY="${pkgs.prisma-engines}/bin/query-engine"
          export PRISMA_QUERY_ENGINE_LIBRARY="${pkgs.prisma-engines}/lib/libquery_engine.node"
          export PRISMA_FMT_BINARY="${pkgs.prisma-engines}/bin/prisma-fmt"        '';
      };
    };
}
Error: Env var PRISMA_QUERY_ENGINE_LIBRARY is provided but provided path /nix/store/pfdqdckvzb77qqbkfh4hjk1v9aj7m2ha-prisma-engines_7-7.8.0/lib/libquery_engine.node can't be resolved.

hello , trying to install prisma , following this Prisma - Official NixOS Wiki however
i get this error

i am not really sure what’s the path to provide for PRISMA_QUERY_ENGINE_LIBRARY
the one in wiki doesn’t seems to work
any idea how to fix it?

Hi.

Please fix the code block issue in the post.

Did you check whether that path exists? Try exploring the contents of that store path.

I tried fixing it but couldn’t. i believe this is due to the quotes for env vars.

regarding path, it does not exists

~
λ tree /nix/store/pfdqdckvzb77qqbkfh4hjk1v9aj7m2ha-prisma-engines_7-7.8.0
/nix/store/pfdqdckvzb77qqbkfh4hjk1v9aj7m2ha-prisma-engines_7-7.8.0
├── bin
│   └── schema-engine
└── nix-support
    └── setup-hook


λ ls /nix/store/pfdqdckvzb77qqbkfh4hjk1v9aj7m2ha-prisma-engines_7-7.8.0/lib/libquery_engine.node
ls: cannot access '/nix/store/pfdqdckvzb77qqbkfh4hjk1v9aj7m2ha-prisma-engines_7-7.8.0/lib/libquery_engine.node': No such file or directory

Look, this attitude of “I couldn’t fix the code blocks because of reasons” is not going to encourage Nix users who spend hours of their days and nights paying meticulous attention to detail, to help to.

I mean I tried, it’s not like I didn’t ? not sure if you can see or not but I edited my post just after posting and tried again after your message but it’s still not getting fixed .

this is how it looks, if you can guide me on fixing it please do so, because just asking me to fix it without help isn’t really helping

FWIW and depending on what you’re trying to achieve, here is a possible interpretation, you can compare the syntax and/or fix guided by intent. Sidenote regarding editor copy paste: A formatter and a working clipboard implementation help a lot, be it nixfmt for the former or just plain osc52 for the latter.

{
  description = "HoogleDrive";

  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
  };

  outputs =
    { self, nixpkgs }:
    let
      system = "x86_64-linux";
      pkgs = nixpkgs.legacyPackages.${system};
    in
    {
      devShells.${system}.default = pkgs.mkShell {
        packages = with pkgs; [
          nodejs_24
          openssl
          prisma-engines
          prisma
        ];

        shellHook = ''
          export PKG_CONFIG_PATH="${pkgs.openssl.dev}/lib/pkgconfig"
          export PRISMA_SCHEMA_ENGINE_BINARY="${pkgs.prisma-engines}/bin/schema-engine"
          export PRISMA_QUERY_ENGINE_BINARY="${pkgs.prisma-engines}/bin/query-engine"
          export PRISMA_QUERY_ENGINE_LIBRARY="${pkgs.prisma-engines}/lib/libquery_engine.node"
          export PRISMA_FMT_BINARY="${pkgs.prisma-engines}/bin/prisma-fmt"
       '';
      };
    };
}

hello , trying to install prisma , following this Prisma - Official NixOS Wiki however
i get this error

Error: Env var PRISMA_QUERY_ENGINE_LIBRARY is provided but provided path /nix/store/pfdqdckvzb77qqbkfh4hjk1v9aj7m2ha-prisma-engines_7-7.8.0/lib/libquery_engine.node can’t be resolved.

i am not really sure what’s the path to provide for PRISMA_QUERY_ENGINE_LIBRARY

the one in wiki doesn’t seems to work
any idea how to fix it?

  1. use markdown mode
  2. make sure you know what fenced code blocks look like
  3. look for extraneous triple backticks

i fixed it finally, all i had to do was to use triple backticks in new line :smile:

Whatever, nix and markdown are entirely unrelated, so triple backticks are certainly not a fix in the nix problem space.

Try prisma-engines_6 or prisma-engines_7 (NixOS Search)

P.S. nixpkgs/pkgs/by-name/pr/prisma-engines_6/package.nix at 34268251cf5547d39063f2c5ea9a196246f7f3a6 · NixOS/nixpkgs · GitHub refers to GitHub - pimeys/nix-prisma-example at 15f51970235c57d516bd6f04177e715a1f7e6d25 · GitHub

Your code looks correct. The upstream package links to this repo as an example, and it uses the same variables and locations: nix-prisma-example/flake.nix at 15f51970235c57d516bd6f04177e715a1f7e6d25 · pimeys/nix-prisma-example · GitHub

That repo hasn’t been updated in 3 years though, and I’d guess the wiki is similarly out of date. You might in fact be the first to try this again in 3 years.

My best guess is that the way rustPlatform ends up building this has subtly changed, and that either the lib/libquery_engine.node has inadvertently become part of the dev output, or the package output layout has otherwise changed. That, or you have a corrupt package on your hands.

Can you run:

cd $PRISMA_QUERY_ENGINE_LIBRARY/../..
ls -l *

And share the output?

1 Like

all I had to do was update prisma,i had prisma 6 in package.json , so updated it to prisma 7 and then used these env vars instead

shellHook = ''

          export PKG_CONFIG_PATH="${pkgs.openssl.dev}/lib/pkgconfig"

          export PRISMA_SCHEMA_ENGINE_BINARY="${pkgs.prisma-engines}/bin/schema-engine"

          export PRISMA_FMT_BINARY="${pkgs.prisma-engines}/bin/prisma-fmt"

        '';
1 Like