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

Replace usages of cargoLock with cargoHash #526

Merged
merged 1 commit into from
Dec 19, 2024

Conversation

oidro
Copy link
Contributor

@oidro oidro commented Dec 15, 2024

While investigating my system flake's evaluation time I noticed that removing nixos-cosmic caused a considerable speedup—through some searching I found NixOS/nixpkgs#327063, which led me to believe that the usage of cargoLock across the packages in this repository was the culprit.

After converting all of the packages to use cargoHash via the script linked in NixOS/nixpkgs#357257, my evaluation time dropped by 6 seconds, as evidenced by hyperfine:

Before:

Benchmark 1: nix eval '.#nixosConfigurations."desktop".config.system.build.toplevel' --no-eval-cache --impure
  Time (mean ± σ):     17.984 s ±  0.130 s    [User: 13.300 s, System: 1.888 s]
  Range (min … max):   17.869 s … 18.126 s    3 runs

After:

Benchmark 1: nix eval '.#nixosConfigurations."desktop".config.system.build.toplevel' --no-eval-cache --impure
  Time (mean ± σ):     12.115 s ±  0.115 s    [User: 9.270 s, System: 1.286 s]
  Range (min … max):   12.013 s … 12.239 s    3 runs

I ran nix build on a couple of the packages to make sure nothing was obviously broken, and they built fine, but I lack the processing power to check all of them 😅

Also, I am not sure if any changes would have to be made to the CI or Cachix action as a result of this, it looks like they can handle cargoHash though!

@drakon64
Copy link
Collaborator

drakon64 commented Dec 15, 2024

Currently the new useFetchCargoVendor requires NixOS/nixpkgs#282798 to be merged otherwise a lot of builds are going to fail.

Also, useFetchCargoVendor isn't available in 24.11 yet. I'm pretty sure there was a PR to backport it though. I was wrong, NixOS/nixpkgs#362288 has been backported.

@drakon64
Copy link
Collaborator

drakon64 commented Dec 15, 2024

Actually, I can attempt a build against this branch

https://github.com/drakon64/nixos-cosmic/actions/runs/12340727082

@lilyinstarlight lilyinstarlight enabled auto-merge (squash) December 18, 2024 17:06
@lilyinstarlight lilyinstarlight merged commit eb20ad0 into lilyinstarlight:main Dec 19, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants