-
Notifications
You must be signed in to change notification settings - Fork 274
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
[FEATURE]: Add package for Nix/NixOS #4935
Comments
Here is an initial version using the binary distribution for now: https://github.com/sagikazarmark/nix-garden |
@sagikazarmark Cool, thank you for working on this! In our contributing guide we have a section about how to build the release binaries and docker containers. In NixOS you use glibc by default, right? Basically we need the built pkg vercel nodejs binary, and a "static" directory (that needs to be initialized as a git repository unfortunately right now). See also the debian Dockerfile: https://github.com/garden-io/garden/blob/main/support/buster.Dockerfile#L47C2-L47C2 Happy to help if you run into problems. |
Unfortunately we have no official ARM binaries yet, which should be straightforward to change nowadays but we are tracking a separate issue for that: #1547 |
@stefreak thanks for getting back to me. As far as I understand the value behind building the vercel pkg binaries is to distribute garden as a single executable. I'm not sure the Nix package needs that as Nix is perfectly capable of installing Node as a dependency as well. The repo I linked above already uses the binary distribution which is a good start IMO, but I'd like to play a bit with skipping the final vercel build and just use ... the artifact that comes before that. A script file? Not sure yet.
Yep
One problem I already have (with the binary distributed version) is this:
Nix puts all packages in a so-called "Nix store" (basically /nix in the filesystem) and makes them read-only and owned by root, to make sure no accidental modifications happen. I'll take a look at the links you've provided and come back if I have any questions. Thanks! |
@sagikazarmark then it might be possible that #4047 has to be finished first, where we get rid of the requirement that the static directory is a git repository. |
@stefreak I managed to work around the problem for now: https://github.com/sagikazarmark/nix-garden/blob/main/flake.nix#L93-L98 The binary distribution seems to be working for the moment, so I'll test it in the next couple weeks and then submit it to the official Nix repository. I'll keep working on the vercel-less version in the meantime. |
@sagikazarmark as a user of Nix and Guix this is something I've wanted for a long time (I created an issue in nixpkgs but never got around to filling). Since I use Guix System on my personal laptop, I created a Guix package for ldd garden
linux-vdso.so.1 (0x00007ffcbbfe9000)
libdl.so.2 => /gnu/store/ip9mj1pwymxi1yq32zbhwp3n3bycy6yi-glibc-2.35/lib/libdl.so.2 (0x00007fd2f5496000)
libstdc++.so.6 => not found
libm.so.6 => /gnu/store/ip9mj1pwymxi1yq32zbhwp3n3bycy6yi-glibc-2.35/lib/libm.so.6 (0x00007fd2f53b9000)
libgcc_s.so.1 => not found
libpthread.so.0 => /gnu/store/ip9mj1pwymxi1yq32zbhwp3n3bycy6yi-glibc-2.35/lib/libpthread.so.0 (0x00007fd2f53b4000)
libc.so.6 => /gnu/store/ip9mj1pwymxi1yq32zbhwp3n3bycy6yi-glibc-2.35/lib/libc.so.6 (0x00007fd2f51b6000)
/lib64/ld-linux-x86-64.so.2 => /gnu/store/ip9mj1pwymxi1yq32zbhwp3n3bycy6yi-glibc-2.35/lib/ld-linux-x86-64.so.2 (0x00007fd2f549d000) My Guix package definition is unfinished because I've noticed you don't use In any case, thanks for your efforts to package |
@worldofgeese I only used the package on macOS so far, so that might answer why it works. The garden binary itself is packaged using vercel/pkg which I think we should be able to omit (that could also make packaging easier). |
@sagikazarmark I spoke with @TimBeyer to understand our binary build process a little more:
There are performance penalties to using Pkg in the resulting binary so it may be we see performance improvements by pursuing either of these alternatives in our own definitions. |
@worldofgeese these are great news! I could see either of these happening.
I believe we should pursue both (given publishing on NPM is something you can/want to do), but for the long term, option 1 is probably a better solution.
I definitely see that penalty on macOS (especially due to the Rosetta requirement). |
We just published a release with native ARM binaries for macOS which has much improved performance over the version running via Rosetta. There's still a small overhead for running in |
@TimBeyer thanks! I upgraded to the new version: sagikazarmark/nix-garden@8d05717 It is indeed somewhat better. Looking at the latest release note I noticed there is a self-update option. @worldofgeese I think it would be nice if we could disable it somehow in the nix packaged version. |
@sagikazarmark I'm working on this after work hours so I won't be the fastest person in the world but I made some good progress today! I found a yarn package definition for Guix (make sure it's 1.* because we're not compatible with 2), built it, opened a shell into its definition ( Next steps will be to compose these steps into a definition, which I've already started on. |
@worldofgeese I also started to work on a definition here: sagikazarmark/nix-garden@b621f9f Unfortunately, yarn build fails with the following error:
Unfortunately, it doesn't tell more about what the problem is. It could be some automagic, that mkYarnPackage does (I noticed for example that garden utilizes workspaces), but I haven't been able to figure out the problem so far. I have two suggestions for making progress at this point:
I understand the time constraints, so I think it makes sense to not duplicate efforts. What do you think? |
@sagikazarmark I built a Looking at your Nix package and based on In any case, based on our shared difficulties, I suggest creating an NPM package of Happy to work on any common repo with the objective of getting these accepted into their respective homes (Nixpkgs and nonguix)! |
@worldofgeese great news! Since the binary distribution works rather well at the moment, I think it makes sense to wait for an NPM package instead of struggling to come up with a build definition (that may never work). One thing that doesn't work with the NPM definition is disabling self-update though (which is a bit unfortunate, but not the end of the world). |
@sagikazarmark your original approach should work fine, can you maybe dig deeper into why
The output contains the log line Does the |
@stefreak @sagikazarmark I have a PR I'm hoping to get up end of day today that adds an NPM package to simplify this process. You can already try it with I've tested with my own projects and it works great for all commands I've tested. In fact, it is significantly faster in all operations. EDIT: it's up without any context. I will add more details later tonight or by the morning. |
We re-did how we build Garden and implemented a new binary shipping mechanism ( We now implement some environment variables in this wrapper binary: https://github.com/garden-io/garden/blob/main/garden-sea/src/node.rs#L43C12-L43C12 We also updated Node.js to |
If we want to go down the NPM package path, #4477 is resolved now so the NPM PR is unblocked and we can continue working on it. |
Feature Request
Background / Motivation
I use Nix as my package manager for macOS and Linux.
What should the user be able to do?
Install garden using Nix.
Why do they want to do this? What problem does it solve?
Nix is particularly useful in creating portable development environments. Since garden is often used for development, integrating it into such environments is crucial.
Suggested Implementation(s)
Create a Nix package.
How important is this feature for you/your team?
🌵 Not having this feature makes using Garden painful
Additional information
There is already a closed issue asking for a Nix package: #2785
I decided to open a new issue, because I'd be happy to do the work, but I'd need some assistance because I'm not intimately familiar how Node CLIs are packaged (particularly garden seems to require some additional files for it to run).
What I need to be able to create a Nix package:
I tried following the contributing guide, but it's not obvious what the output of
yarn build
is.Any assistance would be greatly appreciated.
Thanks!
The text was updated successfully, but these errors were encountered: