VanCoding / nix-prisma-utils

A nix library to make [prisma](https://www.prisma.io/) work in your nix shell
21 stars 5 forks source link

Prisma 4.8.1 fails #3

Closed 44100hertz closed 6 months ago

44100hertz commented 6 months ago

When trying to build Prisma 4.8.1 (the selected version for electric-sql), I get this error:

trace: d6e67a83f971b175a593ccc12e15c4a757f93ffe
error: builder for '/nix/store/9lb25c3r4w9w0khh3fgqgks2q93fvqcz-https-binaries.prisma.sh-all_commits-d6e67a83f971b175a593ccc12e15c4a757f93ffe-debian-openssl-3.0.x-schema-en
gine.gz.drv' failed with exit code 1;
       last 7 log lines:
       >
       > trying https://binaries.prisma.sh/all_commits/d6e67a83f971b175a593ccc12e15c4a757f93ffe/debian-openssl-3.0.x/schema-engine.gz
       >   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
       >                                  Dload  Upload   Total   Spent    Left  Speed
       >   0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
       > curl: (22) The requested URL returned error: 404
       > error: cannot download https-binaries.prisma.sh-all_commits-d6e67a83f971b175a593ccc12e15c4a757f93ffe-debian-openssl-3.0.x-schema-engine.gz from any mirror
       For full logs, run 'nix log /nix/store/9lb25c3r4w9w0khh3fgqgks2q93fvqcz-https-binaries.prisma.sh-all_commits-d6e67a83f971b175a593ccc12e15c4a757f93ffe-debian-openssl-
3.0.x-schema-engine.gz.drv'.
error: 1 dependencies of derivation '/nix/store/873l8nckk6pp7x9hf4vzs746hzcivpng-prisma-bin-d6e67a83f971b175a593ccc12e15c4a757f93ffe.drv' failed to build
error: 1 dependencies of derivation '/nix/store/8yqz66cjck67qb0h3kbxgj6dc7mb5qh4-nix-shell-env.drv' failed to build

According to the source file from 4.8.0 (engine is exactly the same between 4.8.0 and 4.8.1), the available binaries are different.

export enum BinaryType {
  queryEngine = 'query-engine',
  libqueryEngine = 'libquery-engine',
  migrationEngine = 'migration-engine',
  introspectionEngine = 'introspection-engine',
  prismaFmt = 'prisma-fmt',
}

In other words, there is no schema engine in 4.8.1. I'm trying to get this work on my machine, so I may just make a fork of this for Prisma 4.8.1. But ideally, someone should do the research about which binaries correspond with which versions and make this package function accordingly.

44100hertz commented 6 months ago

UPDATE: I did get it to work. Here is my 4.8.1 flake with pnpm. No fork needed.

{
  inputs.pkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
  inputs.prisma-utils.url = "github:VanCoding/nix-prisma-utils";

  outputs =
    { pkgs, prisma-utils, ... }:
    let
      nixpkgs = import pkgs { system = "x86_64-linux"; };
      lib = nixpkgs.lib;
      prisma =
        (prisma-utils.lib.prisma-factory {
          inherit nixpkgs;
          query-engine-hash = "sha256-nffpy13K7Z+ZLUjkdLyLIN1+mIaDpFJ7yglal4rWO9o=";
          libquery-engine-hash = "sha256-o/16nzI8emeM1EvCdqtL53CJ7yEyJjWusKovGXMllo4=";
          migration-engine-hash = "sha256-u3jxty/tUI5/QrR8DJKionMtlpccs7XTBb0Hqqg7gi0=";
          introspection-engine-hash = "sha256-IODNrQ4J0pyJiOjIegI/yqgSZjPCF9Uffca1GziHK28=";
          prisma-fmt-hash = "sha256-v0EWddy7VVuxCK9BB8LqnBhIcZet+kVhuvzlKIS+qfs=";
        }).fromPnpmLock
          ./pnpm-lock.yaml; # <--- path to our pnpm-lock.yaml file that contains the version of prisma-engines
    in
    {
      devShells.x86_64-linux.default = nixpkgs.mkShell { shellHook = prisma.shellHook; };
    };
}

A little extra documentation would help a lot here.