chore: add NixOS dev flake pinning Prisma 6.13.0 engines (#2839)

Restores the devShell flake (was untracked and lost from the tree).
nixpkgs-unstable moved prisma to 7.x while the repo pins
@prisma/client 6.13.0, and nixpkgs never packaged 6.13.0 (jumps
6.7 -> 6.18). Prisma verifies the engine commit matches the client
exactly, so the shell fetches Prisma's official prebuilt 6.13.0
engines (commit 361e86d0...) and patchelfs them for NixOS instead of
drifting the pinned client or building from source.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Zachary Lowden
2026-06-30 12:16:31 -05:00
committed by GitHub
parent 43bed436e1
commit 7fa2780a6c
2 changed files with 95 additions and 0 deletions
Generated
+27
View File
@@ -0,0 +1,27 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1776949667,
"narHash": "sha256-GMSVw35Q+294GlrTUKlx087E31z7KurReQ1YHSKp5iw=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "01fbdeef22b76df85ea168fbfe1bfd9e63681b30",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}
+68
View File
@@ -0,0 +1,68 @@
{
description = "Civitai development shell (NixOS)";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
};
outputs = { self, nixpkgs }:
let
system = "x86_64-linux";
pkgs = import nixpkgs { inherit system; };
# Prisma engines must match the npm @prisma/client version EXACTLY (engine
# commit is embedded in the client and verified at runtime). The project
# pins @prisma/client 6.13.0, but nixpkgs never packaged 6.13.0
# (prisma-engines jumps 6.7 -> 6.18), so we fetch Prisma's official
# prebuilt 6.13.0 engines and patchelf them onto NixOS instead of building
# from source or drifting the repo's pinned client version.
#
# Commit comes from node_modules/@prisma/engines-version
# (6.13.0-35.<commit>). Bump both together if @prisma/client changes.
engineCommit = "361e86d0ea4987e9f53a565309b3eed797a6bcbd";
enginePlatform = "debian-openssl-3.0.x"; # links libssl/libcrypto .so.3, satisfied by pkgs.openssl
fetchEngine = file: sha256: pkgs.fetchurl {
url = "https://binaries.prisma.sh/all_commits/${engineCommit}/${enginePlatform}/${file}.gz";
inherit sha256;
};
prisma-engines = pkgs.stdenvNoCC.mkDerivation {
pname = "prisma-engines";
version = "6.13.0";
dontUnpack = true;
nativeBuildInputs = [ pkgs.autoPatchelfHook pkgs.gzip ];
buildInputs = [ pkgs.openssl pkgs.stdenv.cc.cc.lib pkgs.zlib ];
dontStrip = true;
queryLib = fetchEngine "libquery_engine.so.node" "0gamcinpfb8gvli48z16a378ziyinsanniddgbmd93v1lisllcz2";
schemaEngine = fetchEngine "schema-engine" "0rjwada7j2gdqx5xwbxqdvhr2c8jk2mjzhyblfbryiazyv3i9ir9";
queryEngine = fetchEngine "query-engine" "0iiknxyygq62g1n64h7nfpbfkmq5pi6d8i8di5hyv09hsmzbaimd";
buildPhase = ''
mkdir -p $out/lib $out/bin
gzip -dc $queryLib > $out/lib/libquery_engine.node
gzip -dc $schemaEngine > $out/bin/schema-engine
gzip -dc $queryEngine > $out/bin/query-engine
chmod +x $out/bin/schema-engine $out/bin/query-engine
'';
};
in {
packages.${system}.prisma-engines = prisma-engines;
devShells.${system}.default = pkgs.mkShell {
buildInputs = with pkgs; [
nodejs_20
pnpm
openssl
clickhouse
postgresql_16
redis
];
env = {
PRISMA_QUERY_ENGINE_LIBRARY = "${prisma-engines}/lib/libquery_engine.node";
PRISMA_QUERY_ENGINE_BINARY = "${prisma-engines}/bin/query-engine";
PRISMA_SCHEMA_ENGINE_BINARY = "${prisma-engines}/bin/schema-engine";
};
};
};
}