New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: support NixOS natively out of the box #23672
Draft
aqrln
wants to merge
11
commits into
main
Choose a base branch
from
nixos-support
base: main
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
size-limit report 📦
|
aqrln
changed the title
feat: support NixOS natively
feat: support NixOS natively out of the box
Mar 31, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Using Prisma on NixOS is unnecessarily difficult right now and requires using custom engines and setting environment variables, using flakes etc, so let's fix it and make it just work out of the box as well.
Additionally, when trying to use Prisma on other Linux systems with Node.js installed with Nix (including Replit), the query engine library fails with misleading and incomprehensible error messages, leading users to believe that the problem is with incorrect OpenSSL version being detected or with OpenSSL not being installed (see #17635 and #20905). By using NixOS compatible engines in those setups as well, those issues will be solved.
All of these setups should just work, out of the box, with no extra effort from the user, on both x86_64 and ARM64, like Prisma works on other distros or with Node.js installed via other package managers.
This requires downloading the binaries the Nix way and putting them into the store, which this PR implements.
It is not expected to share a generated client between NixOS machines without re-generating but it is possible if the engines closures are exported from the store too. The recommended way to do that, however, would be to package the app with Nix, which users who need this likely do anyway. The primary use case this PR has in mind is local development, especially in projects/teams where most people don't use Nix and it is undesirable to introduce Nix-specific tooling in the project.
Lurkers beware: this is not planned work but my own personal contribution in my spare time to solve my own pain point. There's no guarantee this will be merged at all as this was never discussed with anyone yet, and the team as a whole may still decide we do not want to directly support NixOS and other Nix-based environments if this means maintaining extra code.
Fixes: #17635
Fixes: #18531
Fixes: #20905
Closes: #11820
Closes: #21056
Closes: #17818
Ref: #17900 (technically not directly related but NixOS seems to be the main/only way to run into that so we can decide to close anyway)
/etc/os-release
is not (e.g. nix docker image)linux-nixos
orlinux-nixos-arm64
if we are not on Linux withnix-build
andnix-store
available in PATHlinux-nixos
is added inbinaryTargets
explicitly rather than beingnative