Skip to content
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

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

AndersonTorres
Copy link
Member

Description of changes

Playing a little bit with the module system proposed by @Atemu at #312432.

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.11 Release Notes (or backporting 23.11 and 24.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

{
options = {
interfaces = lib.mkOption {
default = [ "SDL2" "term" "wx" "x11" ];
Copy link
Member

@Atemu Atemu Sep 16, 2024

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;
}

Copy link
Member Author

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;
      # . . .
    };
  };
};

Copy link
Member

@Atemu Atemu Sep 16, 2024

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.

Copy link
Member Author

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.

@Atemu
Copy link
Member

Atemu commented Sep 16, 2024

When you have individual options, you could also experiment with having the buildInputs deps declared with each option like I did with ffmpeg.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants