fix: don't reevaluate nixpkgs in nixosConfigurations#93
Conversation
|
Sounds good once the CI is fixed. hostPlatform can also be a string sometimes. |
I find that weird. Even if I set it as a string, when reading it, it's always an attrset here. Do you know why? |
a25d972 to
af5e916
Compare
|
@yajo CI LGTM now, it's just the formatter who isn't pleased yet. Would fix it myself don't have write access to the branch and opening another PR seems like too much overhead :) |
af5e916 to
09f4cc8
Compare
|
Thanks! Fixed. |
Before this fix, `pkgs` was reevaluated in NixOS configurations. If any `nixpkgs.config` or `nixpkgs.overlays` was set, it got lost. Besides, this caused a performance penalty. Besides, it was impossible to redefine `nixpkgs.pkgs` downstream because `perSystemModule` depended on `pkgs`. Any redefinition caused an infinite loop. Now it depends on `nixpkgs.hostPlatform`, which must be set in each machine configuration, so the loop is gone. @moduon MT-9339
09f4cc8 to
deee573
Compare
|
Thank you! :) |
|
After this PR was merged I can no longer use |
The problem is caused by |
|
This seems to cause an infinite recursion when used with nixos-facter? I get this infinite recursion where |
You should apply the config like explained here: https://github.com/numtide/blueprint/blob/main/docs/configuration.md#nixpkgsconfig You'll get the same result, but with better performance. |
I can't do that because I need to apply this conditionally (for example overriding some packages & enabling cuda only for systems with Nvidia GPU) Is there a way I can avoid |
|
What you can do in that case is to make the override conditional. I have something similar here. You have to somehow declare the machine has NVIDIA, right? So this just reads that config and applies the wanted override (in this case just for a package) based on that condition. You don't really need to set |
I cannot apply overrides or use Modifying every package that may need to use cuda or every package that depend on a patched package (when the patch is only needed for some systems) without overrides seem to require too much of boilerplate code compared to a single override |
|
There is some tension between For this use-case, we might want the reverse: upstream a That would allow satisfying both use-cases here. |
maybe you could just set |
Before this fix,
pkgswas reevaluated in NixOS configurations. If anynixpkgs.configornixpkgs.overlayswas set, it got lost. Besides, this caused a performance penalty.Besides, it was impossible to redefine
nixpkgs.pkgsdownstream becauseperSystemModuledepended onpkgs. Any redefinition caused an infinite loop. Now it depends onnixpkgs.hostPlatform, which must be set in each machine configuration, so the loop is gone.@moduon MT-9339