-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
How to link nix statically #1418
Comments
~2 seconds for dynamic linking sounds way too high. For example, on my laptop:
|
Can you provide the |
Yes, when using I got this from git tag |
Now that nix 2.0 is out with the amazing mount-namespace option in |
Nix once had a flag to build it statically but it was removed (5414b3b). I think we only used it for Cygwin. |
I'm trying to generate rpm that installs nix so I can use it on CentOS machines. The problem I'm seeing is that nix has many dependencies that are not even available on the standard system (for example libsodium available in epel, nix uses -std=c++14 which is available in g++ 5.0 but the compiled binary will then depend on corresponding libstdc++. It is quickly becoming a mess. Since nix is meant to be a package manager having another package manager to resolve its dependencies will degrade user experience. |
It seems a static build of nix is in Nixpkgs now due to NixOS/nixpkgs@c86af90, does that solve this issue? |
#3765 needs to be fixed up. I think @matthewbauer has some tricks up his sleave for this. (do note that PR while I opened it is his work.) |
Thanks @Ericson2314. I was just writing up an issue actually to describe some issues I've seen with the static Nix build as it stands today. Basically it seems to still depend on paths in |
As I worked on the worked protocol I noticed that it queries for pathes over the protocol, and fails if there aren't valid (pathes like bohemgc). |
There are still references to .nix files in /corepkgs, which are needed if you want to build things. That can be overridden by setting You may or may not also need a "sandbox shell" which can be overridden with |
@matthewbauer I tried both of those things and I'm still getting the same result. Pretty much all nix commands fail with
The path it's trying to find is that of the statically built nix itself. Running
Like I said, I'm happy to provide a repro if it would be helpful. |
You may need to use this PR: #3765. I think the "getting status" issue in |
I marked this as stale due to inactivity. → More info |
I did a quick
perf
profile on mynix-instantiate
that takes 2 seconds, and it suggests that most time (in fact, suspiciously too much time) is spentdo_lookup_x
, which seems to be shared library symbol lookup.Is it possible to link
nix-instantiate
(or even all nix programs) statically?The text was updated successfully, but these errors were encountered: