49 lines
1.8 KiB
Nix
49 lines
1.8 KiB
Nix
{ pkgs ? import <nixpkgs> {} }:
|
|
|
|
(pkgs.buildFHSEnv {
|
|
name = "prisma-v7-shell";
|
|
|
|
targetPkgs = pkgs: (with pkgs; [
|
|
nodejs
|
|
pnpm
|
|
openssl
|
|
zlib
|
|
]);
|
|
|
|
runScript = "bash";
|
|
|
|
profile = ''
|
|
# 1. Define the correct version and commit for Prisma 7.2.0
|
|
PRISMA_VERSION="7.2.0"
|
|
COMMIT="0c8ef2ce45c83248ab3df073180d5eda9e8be7a3"
|
|
|
|
# 2. Setup cache directory
|
|
CACHE_DIR="$HOME/.cache/prisma-nix-fix/$PRISMA_VERSION"
|
|
mkdir -p "$CACHE_DIR"
|
|
|
|
# 3. Only download schema-engine (REQUIRED for migrations)
|
|
# Prisma 7 does not use the Rust query-engine by default, so we skip it to avoid 404s.
|
|
if [ ! -f "$CACHE_DIR/schema-engine" ]; then
|
|
echo ">> NixOS Fix: Downloading schema-engine for Prisma $PRISMA_VERSION..."
|
|
# Use -f to fail silently if the file is missing (though it shouldn't be for schema-engine)
|
|
curl -fL "https://binaries.prisma.sh/all_commits/$COMMIT/debian-openssl-3.0.x/schema-engine.gz" | gunzip > "$CACHE_DIR/schema-engine"
|
|
chmod +x "$CACHE_DIR/schema-engine"
|
|
fi
|
|
|
|
# 4. Export the specific variable for the Schema Engine
|
|
export PRISMA_SCHEMA_ENGINE_BINARY="$CACHE_DIR/schema-engine"
|
|
|
|
# 5. UNSET the query engine variables.
|
|
# Prisma 7 will fall back to its internal TypeScript engine (which works fine in FHS).
|
|
# If we leave these set to broken files (from the 404s), Prisma crashes.
|
|
unset PRISMA_QUERY_ENGINE_BINARY
|
|
unset PRISMA_QUERY_ENGINE_LIBRARY
|
|
unset PRISMA_FMT_BINARY
|
|
|
|
echo "------------------------------------------------------------"
|
|
echo " Prisma 7.x Shell (NixOS)"
|
|
echo " - Schema Engine: Pinned to Debian OpenSSL 3.0.x"
|
|
echo " - Query Engine: Using Prisma Default (TypeScript)"
|
|
echo "------------------------------------------------------------"
|
|
'';
|
|
}).env
|