58 lines
2.0 KiB
Nix
58 lines
2.0 KiB
Nix
{
|
|
description = "Prisma 6 development environment";
|
|
|
|
inputs = {
|
|
# Use nixos-23.11 which has Prisma 5.4.1 engines (compatible with Prisma 6)
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
|
|
flake-utils.url = "github:numtide/flake-utils";
|
|
};
|
|
|
|
outputs = { self, nixpkgs, flake-utils }:
|
|
flake-utils.lib.eachDefaultSystem (system: let
|
|
pkgs = nixpkgs.legacyPackages.${system};
|
|
engines = pkgs.prisma-engines;
|
|
|
|
in {
|
|
devShells.default = pkgs.mkShell {
|
|
buildInputs = with pkgs; [
|
|
nodejs_18 # Prisma 6 works best with Node 18
|
|
yarn
|
|
prisma-engines
|
|
openssl.dev # For database connections
|
|
];
|
|
|
|
shellHook = ''
|
|
echo "=== Setting up Prisma 6 ==="
|
|
echo "Using prisma-engines: $(basename ${engines})"
|
|
echo ""
|
|
|
|
# Prisma 6 engine paths
|
|
export PRISMA_SCHEMA_ENGINE_BINARY="${engines}/bin/schema-engine"
|
|
export PRISMA_QUERY_ENGINE_BINARY="${engines}/bin/query-engine"
|
|
export PRISMA_INTROSPECTION_ENGINE_BINARY="${engines}/bin/introspection-engine"
|
|
export PRISMA_FMT_BINARY="${engines}/bin/prisma-fmt"
|
|
|
|
# Prisma 6 also needs the migration engine for backward compatibility
|
|
if [ -f "${engines}/bin/migration-engine" ]; then
|
|
export PRISMA_MIGRATION_ENGINE_BINARY="${engines}/bin/migration-engine"
|
|
fi
|
|
|
|
# Library file for Prisma 5/6
|
|
export PRISMA_QUERY_ENGINE_LIBRARY="${engines}/lib/libquery_engine.node"
|
|
|
|
# Skip download attempts
|
|
export PRISMA_ENGINES_CHECKSUM_IGNORE_MISSING=1
|
|
|
|
# SSL for databases
|
|
export PKG_CONFIG_PATH="${pkgs.openssl.dev}/lib/pkgconfig"
|
|
|
|
echo "✅ Prisma 6 environment ready"
|
|
echo "📦 Engines: 5.4.1"
|
|
echo "📦 Node: 18.x"
|
|
echo ""
|
|
echo "Test with: npx prisma --version"
|
|
'';
|
|
};
|
|
});
|
|
}
|