-
-
Notifications
You must be signed in to change notification settings - Fork 13.7k
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
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.