-
-
Notifications
You must be signed in to change notification settings - Fork 15k
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
[RFC] add ability to merge structured configs #42838
Conversation
@dezgeg thanks for reviewing/merging the structured config PR \o/ Being able to specify required config for packages was one of the motivation. I would love some feedback on how to best achieve this since the current way is not practical aka:
I moved the version dependant filters The problem is that if we just pass it like this
it erases conditions (e.g., I wonder if it wouldn't be better to have packages define a list of config items like To sum up, the best interface would be IMO to have in common-config.nix |
I am experimenting a bit as I am trying to solve the initial issue. Without types, the code is hard to follow but what I've come up with is something similar to the module system so that hopefully merging |
lib/debug.nix
Outdated
@@ -77,7 +77,7 @@ rec { | |||
(modify depth snip x)) y; | |||
|
|||
/* A combination of `traceVal` and `traceSeq` */ | |||
traceValSeqFn = f: v: traceVal f (builtins.deepSeq v v); | |||
traceValSeqFn = f: v: traceValFn f (builtins.deepSeq v v); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huh, I thought we merged that line already?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's not up to date. I've started modifying the code to adopt somewhat the module backend so it might be best not to review it now
c16fd9e
to
609ed28
Compare
Thanks to the advice on https://discourse.nixos.org/t/use-lib-types-system-to-merge-attrsets-without-the-module-system/534/10, I managed to use the module system to merge structured configs. I renamed the pull request so that it focuses on this aspect only. It seems to work for basic things (linux_latest) but I am sure I've broken things in other places. I tried to preserve the current api ( One problem is for the "freeform" options like currently I've converted the items of the form |
I went ahead and proceeded with the modifications:
Here is what I test with:
You can then have a look at the generated config via I am sure the code may be improved and there are some cases that might break. I would like to write some tests but not sure how to do. |
Can |
I did well to check several mistakes had crept in. |
@teto Merge conflict |
This should make the composability of kernel configurations more straigthforward. - now distinguish freeform options from tristate ones - will look for a structured config in kernelPatches too one can now access the structuredConfig from a kernel via linux_test.configfile.structuredConfig in order to reinject it into another kernel, no need to rewrite the config from scratch The following merge strategies are used in case of conflict: -- freeform items must be equal or they conflict (mergeEqualOption) -- for tristate (y/m/n) entries, I use the mergeAnswer strategy which takes the best available value, "best" being defined by the user (by default "y" > "m" > "n", e.g. if one entry is both marked "y" and "n", "y" wins) -- if one item is both marked optional/mandatory, mandatory wins (mergeFalseByDefault)
@infinisil ty, pushed an update. |
Evaluation fails now, messed up in all-packages.nix |
hype hype, thanks all! :D
…On Sun, 27 Jan 2019 16:11:48 -0800, Matthieu Coudron ***@***.***> wrote:
@infinisil ty, pushed an update.
--
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub:
#42838 (comment) part: text/html
|
@infinisil sorry, the lights were green after my last push, I guess some caching problem on the browser. The timeout for the first check seems to appear once the config was generated so I think it's fine. @dtzWill very excited about this too. The current achievement is the possibility to do |
I think this broke the legacy |
you are right, it shouldn't sorry for that, let me look into this. |
@lopsided98 what kind of error do you have ? I have
which shouldn't be influenceed by my changes. Also I can reproduce this error on nixos-unstable so it must be some other change |
Your error is caused by building it on x86; My error is:
This error was fixed in 5ac7334 by adding |
seems like you are right, extraConfig is not taken into account.It's very late here so I can try tomorrow, until then does
solve it ? |
|
(I've updated the snippet). |
That patch fixes the issue. |
PR NixOS#42838 wrongly started to ignore extraConfig. This fixes that.
Elco didn t want this to leak. Instead of using the alias 'no' you can also pass the submodule directly: SND={answer="n";} |
POC
Motivation for this change
Listed here #41103.
To sum up, I would like programs that require kernel modifications to be able to specify their kernel requirements. This might be disabled etc. but here is a proposition to show how it could look like
Things done
sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)nix path-info -S
before and after)follow up of #41393