-
Notifications
You must be signed in to change notification settings - Fork 343
Add nix evaluators #1665
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
base: main
Are you sure you want to change the base?
Add nix evaluators #1665
Conversation
I'm a bit dubious at installing unofficial binaries. We don't do that with any other compiler or language -- is there another way to do this? What's the issue with the official binaries? Just trying to understand |
I totally know this is not standard and a big leap of faith, You can get a "release" binary from: https://releases.nixos.org/nix/nix-2.29.0/nix-2.29.0-x86_64-linux.tar.xz If you extract it, you have these files: Where in green I tried to mark where nix binary resides, which depends on all the others in one way or the other. These dependencies are harcoded to be in the path /nix/store:
What I do to avoid that, is to use nix itself to generate a statically-linked version of the binary, which is generated from a nix flake using official sources, so it can be replicated to see that it yields the exact same hash. Obviously, I understand that it would be better to get an official distribution from an official repo of the statically-linked version, but due to the nature of nix as package manager, it requires the "setup" of groups/folders/daemons in order to work as package manager, so the use of only the evaluator part of nix is less extended and a statically-linked version is usually not useful at all. I 100% understand if this is a problem to have it in my repo, but I see that there are some compilers being built for compiler-explorer, maybe we could use the same approach? (if the building is containerized, doing the build from a containerized system with nix already installed is trivial) |
For clarity, building a statically-liked version from a flakes-enabled nix installation is something like:
|
Would it make sense to have some kind of "nix" installer type instead? |
(I'm not against using your repo, but wondering if there's a more "proper" way that opens the door to other stuff too) |
Sorry, I don't know if I'm following this:
You mean installing nix directly in the machine? if that can be done, then that's fine, it probably is easy to get away with a single-user installation https://nixos.org/download/ depending if systemd is available or not. From a nix installation, then, you can install any different versions that you want, but the disk usage will be higher. About:
I just wanted to unblock the "nix in compiler-explorer" so it can be already used. I don't have a any strong desire to maintain those versions in my github and I understand that there may be more trust if they are generated from an action inside this repo, for example. Generating a statically-linked versions is super easy if you already have a working installation of nix. |
Sorry @Rucadi - I meant a more general systemwide nix install. we can't have a "single-user" install. We'd need it to run and work off of EFS/NFS, so maybe that's a non-starter for this. |
Nix has multiple pieces to it. There is the evaluator of the language, which is what is under test here, and I believe this doesn't require any kind of install (hence the proposal to get a static binary for it). That seems reasonable to me. I'm in a position to Matt bootstrap into nix and get these static binaires directly from |
I'm trying to understand, really - just trying to get a principled approach to installing these NIX static binaries rather than have them be on @Rucadi 's github page. We can build them ourselves if it's easy (which I think it is) -- we could make our |
I think there are two approaches:
For 2 the most straightforward way is to run There may be some details about storage, I think the evaluator may write out some files as a side effect of evaluation. That can probably either be redirected to a tmpfs, or possibly configured out entirely, but needs a bit of thought as to whether it's a problem or not. |
You are 100% right, that command would be enough to build the latest master branch. The user can create a store in any accessible place using the --store argument, which I try to mitigate in the compiler-explorer implementation using a dummy store (which doesn't allow writting). If it is desired to support derivations and/or internet access, then the store should point to a tmpfs probably. I leave here a small Dockerfile that would generate it:
|
Following compiler-explorer/compiler-explorer#6198 I introduce the installation of the evaluators for nix, to avoid the current status where compiler-explorer returns:
and to fix issue compiler-explorer/compiler-explorer#7811
I tested the "ce" command and it installed correctly, the statically-linked binaries however are taken from my own repo, created for this specific purpose since statically-linked versions are not officially distributed.
I have tested these binaries output but I have not tested the integration within compiler-explorer.