lilyinstarlight / nixos-cosmic

Flake for using COSMIC on NixOS
MIT License
335 stars 25 forks source link

compile cosmic-applets individually? #34

Open MrMonotone opened 6 months ago

MrMonotone commented 6 months ago

Would it be possible to have each applet build as it own job to lower the ram requirements when compiling locally? This would make it convenient to add flags for the ones that you want as well.

lilyinstarlight commented 6 months ago

Yeah this could probably technically be done! Just curious, are you building the applets yourself because you aren't using the binary cache? (e.g. all binaries here should be cached for x86_64-linux and aarch64-linux on cosmic.cachix.org and once this is merged back into nixpkgs, cache.nixos.org)

MrMonotone commented 6 months ago

The cache works great. I just tried to build without it and I ran out of ram with 32GB of it. I tried limiting the jobs to 1 and still ran out. It is not a priority but it would be nice for someone who wants to build locally.

lilyinstarlight commented 6 months ago

The cache works great. I just tried to build without it and I ran out of ram with 32GB of it. I tried limiting the jobs to 1 and still ran out. It is not a priority but it would be nice for someone who wants to build locally.

Limiting jobs likely won't help alone, but also using --cores 1 or some similar number to reduce build parallelism probably will help

But either way, making the derivation take a list argument or something to define which applets to build is probably doable

MrMonotone commented 6 months ago

But either way, making the derivation take a list argument or something to define which applets to build is probably doable

Would it be possible to build each as an individual job?

lilyinstarlight commented 6 months ago

Possibly? Idk, it would be a lot more wasted compiling (especially compared to --cores 1). But I'm not too opposed

atagen commented 5 months ago

had same issue testing #64 . I'm for whatever helps the cache work best since 99% of the time that's what I'll be using too, but it was an unpleasant surprise to OOM while testing a one line nix-side change :smile:

lilyinstarlight commented 5 months ago

had same issue testing #64 . I'm for whatever helps the cache work best since 99% of the time that's what I'll be using too, but it was an unpleasant surprise to OOM while testing a one line nix-side change 😄

I'm still not too opposed to doing this. It's just a tradeoff between wasting shared compilation units by splitting it up versus just setting a parallelism amount (--cores [n]) that won't OOM for however much RAM you do have on your system (which is just a general Nix thing not necessarily specific to Rust or COSMIC, e.g. highly templated C++ apps do it too which is why they actually have a separate set of systems in Hydra with tons of RAM to build some derivations with "big-parallel" set)

Alternatively we could just disable parallel compilation just for cosmic-applets too in the derivation, which would solve the OOM problem and just be a little slower for people who do have enough RAM (but tbh not much slower, so it's definitely viable)