| 17 Jan 2026 |
debtquity | ah, i'll give that a shot. what do we lose with LTO, though? | 06:26:09 |
Charles | https://doc.rust-lang.org/cargo/reference/profiles.html#lto | 06:26:46 |
Charles | summary to the point of being unhelpful: you lose some performance | 06:27:20 |
Marien Zwart | Should be about the same performance as a non-incremental release build, if it's way slower than that you may be building at cores = 1 or something along those lines | 06:28:07 |
debtquity | makes sense, so then whatever I write in overrideAttrs shouldn't be pushed to nixpkgs :) | 06:28:13 |
Charles | yeah | 06:28:31 |
Charles | for in-nixpkgs stuff the runtime performance increase is possibly worth the build time increase since it can then be pulled by multiple users from the binary cache without having to build it themselves | 06:30:40 |
debtquity | another thing i notice is that everytime i run nix build ./#package, it re-compiles all of the project. I thought rust had some build cache mechanism? | 06:33:36 |
Charles | rust does, nix doesn't | 06:33:51 |
debtquity | or maybe that's just the nature of nix? | 06:33:57 |
debtquity | ooh | 06:33:59 |
Charles | * rust (cargo, more accurately) does, nix doesn't | 06:34:00 |
debtquity | so nixpkgs function would need to be improved then | 06:34:29 |
Charles | nix can't do incremental builds, it can only build complete derivations | 06:34:38 |
Charles | you can sort of get incremental builds with nix by breaking up the build into multiple derivations, but that gets complicated | 06:35:03 |
Charles | https://crane.dev kind of does this by splitting the nix builds into two derivations, one for all dependencies, and one for the final binary crate, which helps in some cases but not all, and can't be used in nixpkgs | 06:35:50 |
Charles | nixpkgs doesn't really care about incremental build times since it has to rebuild everything from scratch often enough anyway | 06:36:11 |
Marien Zwart | Depending on what you're doing, crane's separate derivation for dependencies can help a lot (but of course means using crane, not pure nixpkgs) | 06:36:31 |
Marien Zwart | and that's not the same level of incremental builds cargo can provide outside nix | 06:37:18 |
Marien Zwart | Heh, I didn't type that fast enough to be helpful :) | 06:38:03 |
Charles | i mean you clarified some stuff i left implied, not unhelpful at least | 06:40:17 |
Charles | while we're clarifying things, i believe this "can't" is not a "it just hasn't been done yet" situation but more a "it is not possible to do without losing the guarantee of repeatable builds which is kind of the point of nix" situation | 06:44:31 |
debtquity | yea i am not well versed in either, but even if it's a marginal improvement. I think it would help resource wise. Just checking the build times on this project, it takes 37 minutes on hydra (build -> tests -> post install)
https://hydra.nixos.org/build/318543980 | 06:47:46 |
debtquity | a bit surprised my machine builds faster than hydra ha | 06:48:13 |
debtquity | wow, it takes an hour on aarch64-linux
https://hydra.nixos.org/build/318543984
| 06:49:29 |
Charles | the thing is that improving incremental build times is irrelevant for nixpkgs because it already has so many things to build and when any of the dependencies of a thing change, it forces a clean build of the thing, so the only time you'd reap the benefits of fast incremental builds is when only leaf packages change, which i imagine is rare | 06:55:19 |
Charles | e.g. if you have packages X and Y, and X depends on Y, and both X and Y are comprised of multiple derivations to enable incremental builds, and Y changes, having incremental builds for X is irrelevant because you need to rebuild it from scratch now | 06:57:30 |
Charles | and breaking down packages into multiple derivations is pretty complex to implement | 06:58:24 |
Charles | so for nixpkgs the tradeoff is between time saved on builds versus time spent making builds faster, and since rebuilds are so common, it just isn't worth it | 06:59:01 |
Charles | * so for nixpkgs the tradeoff is between time saved on builds versus time spent making builds more incremental, and since rebuilds are so common, it just isn't worth it | 06:59:26 |