Skip to content
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

Reduce size of /nix/store for @latest #2383

Open
fdietze opened this issue Oct 25, 2024 · 3 comments
Open

Reduce size of /nix/store for @latest #2383

fdietze opened this issue Oct 25, 2024 · 3 comments
Labels
feature New feature or request triage Issue needs triage

Comments

@fdietze
Copy link

fdietze commented Oct 25, 2024

What problem are you trying to solve?

When using devbox in CI to build a production release, I often see transitive dependencies of the same version downloaded multiple times, for example:

 ...
 /nix/store/3s3rjkl3mx05wp0lmxgwkaqhbz9sy6kk-gcc-13.3.0
 /nix/store/x8rg4vhgd20i8vzykm1196f9qdb8klhh-gcc-13.3.0
 ...

This is creating lots of traffic and big caches.

It happens, because different packages listed in devbox.json are pointing to the commit hash in nixpkgs corresponding to their version. Even if that version is resolved from latest.

What solution would you like?

Here is an idea, which I'm not sure how practical it is:

Pin all packages using @latest version to the same nixpkgs commit hash.

This would allow them to share most of their transitive dependencies and therefore reduce download sizes.

Alternatives you've considered

Ditching devbox and using flakes directly, with extra inputs for software that I want to pin to a specific version.

@fdietze fdietze added feature New feature or request triage Issue needs triage labels Oct 25, 2024
@gcurtis
Copy link
Collaborator

gcurtis commented Oct 28, 2024

@fdietze devbox should be using the latest nixpkgs commit that has the requested version for each package. So if you add python@latest and go@latest you should end up with the same nixpkgs commit (probably the head of nixpkgs-unstable).

However, once a package is added it gets locked and the nixpkgs commit will never change unless devbox update is run. So if you added python@latest yesterday and go@latest today you might get two separate commits. Running devbox update should synchronize them back to the same commit.

If you're not seeing this behavior, let me know. If you paste your devbox.json and devbox.lock I can help debug further.

@fdietze
Copy link
Author

fdietze commented Oct 29, 2024

Cool, that would be the right approach!

I just tried to run devbox update in this repo: https://github.com/social-protocols/jabble2 and checked the lock-file. The resolved-hashes for all packages are different.

@fdietze
Copy link
Author

fdietze commented Nov 13, 2024

@gcurtis gentle ping, in case you didn't see this yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request triage Issue needs triage
Development

No branches or pull requests

2 participants