-
Notifications
You must be signed in to change notification settings - Fork 25
feat: NixOS / patchelf support #125
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?
Conversation
This allows to use suiup to download and run official sui binaries. Dependencies are tracked via the suiup package
The nix flake now provides fully patched binaries with specific versions and aliases. You can run sui like: `nix run https://github.com/MystenLabs/suiup#sui` or `.#sui-mainnet-1.53.8` The update script `nix run .#update-releases` updates the json.
|
This solution here is the easiest without adding nix flakes to all sui products for now. My goal is to do so for other reasons (building from source, dev environments etc). It depends on you to add the last patch. I like it because it allows this flake to make reproachable build environments with the sui stack you are developing against. I have another branch: https://github.com/poelzi/nix-suiup/tree/nix-release with a github action that updates the release.json and creates a pr or push, depending on setting. Currently in testing and it should update my https://github.com/poelzi/nix-suiup/ repo automatically now. |
|
Thanks @poelzi. I don't have any knowledge of nixOS, so I'll have to rely on you to educate me about it. Where I can read more about this patch, except this: https://nixos.wiki/wiki/Packaging/Binaries ? |
|
@stefan-mysten I can tell you, once you get the hang of nix, you don't get back ;) nix = package manager, you can use it on other distros + macos in parallel nix is a deterministic, lazy evaluated, functional package manager. You have 2 types of derivations, fixed output, where you define what comes out and you have internet access - you can download stuff. This allows to do things like devShells. You checkout your project and type "nix develop" and you share the same development environment with everybody else. No more wasting a day time just to find out that you have some old lib in your system creating bad builds and it works for everybody else. You can rebuild the same software after 3 years. 0 dependency hell. You can start any software with "nix run http://..." that has a flake.nix. For example, running the sui test suite is a mess on your desktop. Tries to connect to postgresql and other dependencies you have to painstakingly try to replicate or clutter your system with installs. The nix way is to define a NixOS VM Test. 0 Headache, works for everybody, 100% reproducible and if the cache is hot, up and running in 2 secs. They are super lightweight. Gets garbage collected. nix is the sui of package managers. The rest is like EVM I would really like to create and maintain proper flake.nix for all sui tools. This suiup, it is more of a hack then the proper nix way. |
|
patchelf is the nixos way to get normal binaries working on nix. Since there is no /usr/lib, you replace the search path RPATH with a list of libraries you want to use. And you need to set the interpreter to the glibc version you want to use. I added the dependencies of all sui tools as a runtime dependency to the suiup derivation and stored the path in an json. After download, I patch the binary with the dependencies of suiup. |
|
Thanks for taking the time to explain in more details, loved learning new things. It makes sense and I'd love to make this possible. I'll get back to you on this ASAP. |
This allows to use suiup to download and run official sui binaries on NixOS.
NixOS does not follow LSB standard but instead uses absolute linking. This feature adds support for running the nix patch process after download. Only active with feature flag.
Dependencies are tracked via the suiup package.