-
-
Notifications
You must be signed in to change notification settings - Fork 14.3k
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
bochs: configure it via module system #342188
base: master
Are you sure you want to change the base?
Conversation
pkgs/by-name/bo/bochs/options.nix
Outdated
{ | ||
options = { | ||
interfaces = lib.mkOption { | ||
default = [ "SDL2" "term" "wx" "x11" ]; |
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.
Lists compose quite poorly. A better design could be to make these a bunch of individual options or a freeform attrset such that you can set them like this:
{
sdl2 = true;
term = true;
wx = true;
x11 = true;
somethinElse = false;
}
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.
a bunch of individual options
Like the previous commit?
0e3afc4
a freeform attrset
Like this?
options = {
interfaces = lib.mkOption {
default = {
sdl = true;
term = true;
# . . .
};
};
};
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.
Like the previous commit?
0e3afc4
Yes, like that.
Like this?
options = { interfaces = lib.mkOption { default = { sdl = true; term = true; # . . . }; }; };
Not quite. This issues because setting the option overrides the entire default attrset, leaving only the overridden values.
What I meant is an RFC42 settings-like option.
This lends itself to scenarios where there are a bunch of settings where it's unreasonable effort to have individual options for each or where you only want to specify a subset of all settings the program can understand.
For packages, I think that's a rather rare requirement though and I don't think it's necessary here.
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.
I like to use Bochs expression as a "test+documentation" example.
I wanna try that settings-like approach just for the docs.
6f84f70
to
07994d7
Compare
When you have individual options, you could also experiment with having the buildInputs deps declared with each option like I did with ffmpeg. |
07994d7
to
6e13087
Compare
39a424f
to
58261fd
Compare
1f0bb75
to
80f290e
Compare
Inspired by Atemu
80f290e
to
1842dc2
Compare
Re: availableOn You can take this one step further if you have the deps declared with the option and automatically apply it to all packages and decide the default on that. I had considered doing something like this for ffmpeg too but IIRC it was too costly in eval time for questionable benefit. I had even gone one step further and tryEval'd the toString of the drv in order to catch any sort of eval failure, including transitive ones. |
I am thinking on how to "extend" this correctly. Usually, SDL packages need to be put in both buildInputs and nativeBuildInputs, especially with strictDeps set as true. This way, a However
|
Would be interesting to know why that is; which executable of SDL gets executed here. This edge-case can be handled by bespoke logic though while everything else still gets handled generically.
I don't see how this would break splicing? The pkgs in
buildInputs are depsHostTarget but we don't call them that for historical reasons. buildPackages are pkgsBuildHost but we don't call them that for ??? reasons. Therefore, buildPackages don't go into buildInputs. (pkgs == pkgsHostTarget) |
My guess: SDL has a On the other hand, Bochs uses |
Description of changes
Playing a little bit with the module system proposed by @Atemu at #312432.
Things done
nix.conf
? (See Nix manual)sandbox = relaxed
sandbox = true
nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)Add a 👍 reaction to pull requests you find important.