Open jordan-bravo opened 4 months ago
Hey Jordan, I ran into the same thing and fixed it by replacing inherit nixpkgs;
with nixpkgs = nixpkgs.legacyPackages.${system};
. The example usage is not set up to work with flake-utils' eachDefaultSystem
, and so inherits the wrong nixpkgs
when used in that context.
I followed your suggestion and replaced inherit nixpkgs;
with nixpkgs = nixpkgs.legacyPackages.${system};
Nix successfully evaluates the flake, but then when it tries to download from the prisma server, it gets a 404 error. Any suggestions?
error: builder for '/nix/store/iyr3n3hr1ii17nwh518cr61mpxncn3h6-https-binaries.prisma.sh-all_commits-4bc8b6e1b66cb932731fb1bdbbc550d1e010de81-debian-openssl-3.0.x-schema-engine.gz.drv' failed with exit code 1;
last 7 log lines:
>
> trying https://binaries.prisma.sh/all_commits/4bc8b6e1b66cb932731fb1bdbbc550d1e010de81/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: (56) The requested URL returned error: 404
> error: cannot download https-binaries.prisma.sh-all_commits-4bc8b6e1b66cb932731fb1bdbbc550d1e010de81-debian-openssl-3.0.x-schema-engine.gz from any mirror
For full logs, run 'nix log /nix/store/iyr3n3hr1ii17nwh518cr61mpxncn3h6-https-binaries.prisma.sh-all_commits-4bc8b6e1b66cb932731fb1bdbbc550d1e010de81-debian-openssl-3.0.x-schema-engine.gz.drv'.
error: 1 dependencies of derivation '/nix/store/8rp3sbqwc9rhp7s15dfdkqsybpbg4ccj-prisma-bin-4bc8b6e1b66cb932731fb1bdbbc550d1e010de81.drv' failed to build
error: 1 dependencies of derivation '/nix/store/62zclpa8gdf339rv24090105vnbqnp8v-nix-shell-env.drv' failed to build
@jordan-bravo Which prisma version are you using? Older versions of prisma might not have binaries for openssl3, similarly, schema-engine might not be available for that version and instead migration-engine and introspection-engine might be needed.
If I try to list the prisma version, it throws a similar 404 Not Found error:
❯ prisma --version
Warning Precompiled engine files are not available for nixos.
> Downloading Prisma engines for Node-API for linux-nixos [ ] 0%
Error: Failed to fetch sha256 checksum at https://binaries.prisma.sh/all_commits/4bc8b6e1b66cb932731fb1bdbbc550d1e010de81/linux-nixos/migration-engine.gz.sha256. 404 Not Found
If you need to ignore this error (e.g. in an offline environment), set the
PRISMA_ENGINES_CHECKSUM_IGNORE_MISSING environment variable to a truthy value.
Example: PRISMA_ENGINES_CHECKSUM_IGNORE_MISSING=1
If I follow the suggestion and set PRISMA_ENGINES_CHECKSUM_IGNORE_MISSING=1
, it still has the same problem:
❯ PRISMA_ENGINES_CHECKSUM_IGNORE_MISSING=1 prisma --version
Warning Precompiled engine files are not available for nixos.
> Downloading Prisma engines for Node-API for linux-nixos [ ] 0%
Error: Not Found https://binaries.prisma.sh/all_commits/4bc8b6e1b66cb932731fb1bdbbc550d1e010de81/linux-nixos/migration-engine.gz
@jordan-bravo No, I mean what's the version of your prisma package in the package.json?
Oh, it's 4.16.2
I was able to get prisma working on NixOS without using nix-prisma-utils
by pinning nixpkgs with the same major version of prisma (4.x.y) as listed in the package.json
.
My question is, how can I do this with nix-prisma-utils
? Here is my flake that is currently working properly without nix-prisma-utils
:
{
description = "This Nix flake creates a development shell for the Customer API that provides the
required versions of dependencies such as NodeJS 18 and Prisma 4";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
nixpkgs-prisma-4.url = "github:NixOS/nixpkgs/29bcead8405cfe4c00085843eb372cc43837bb9d";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { nixpkgs, nixpkgs-prisma-4, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = nixpkgs.legacyPackages.${system};
pkgs-prisma-4 = nixpkgs-prisma-4.legacyPackages.${system};
in {
devShells.default = pkgs.mkShell {
nativeBuildInputs = [ pkgs.bashInteractive ];
buildInputs = [
pkgs.nodejs_18
pkgs-prisma-4.nodePackages.prisma
pkgs-prisma-4.prisma-engines
];
shellHook = with pkgs-prisma-4; ''
export PRISMA_MIGRATION_ENGINE_BINARY="${prisma-engines}/bin/migration-engine"
export PRISMA_SCHEMA_ENGINE_BINARY="${prisma-engines}/bin/schema-engine"
export PRISMA_QUERY_ENGINE_BINARY="${prisma-engines}/bin/query-engine"
export PRISMA_QUERY_ENGINE_LIBRARY="${prisma-engines}/lib/libquery_engine.node"
export PRISMA_INTROSPECTION_ENGINE_BINARY="${prisma-engines}/bin/introspection-engine"
export PRISMA_FMT_BINARY="${prisma-engines}/bin/prisma-fmt"
export PATH="$PWD/node_modules/.bin:$PATH"
'';
};
});
}
I have a development flake for a project using prisma. I tried adding nix-prisma-utils following the README, and the flake fails to evaluate with the error:
Here is what the flake looks like: