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

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions pkgs/by-name/bo/bochs/options.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
lib,
config,
stdenv,
_pkgs,
...
}:

{
options = {
SDL2 = lib.mkOption {
type = lib.types.bool;
default = lib.meta.availableOn stdenv.hostPlatform _pkgs.SDL2;
description = ''
Enable SDL2 interface.
'';
};
X11 = lib.mkOption {
type = lib.types.bool;
default = lib.meta.availableOn stdenv.hostPlatform _pkgs.libX11;
description = ''
Enable X11 interface.
'';
};
term = lib.mkOption {
type = lib.types.bool;
default = lib.meta.availableOn stdenv.hostPlatform _pkgs.ncurses;
description = ''
Enable ncurses terminal interface.
'';
};
wx = lib.mkOption {
type = lib.types.bool;
default = lib.meta.availableOn stdenv.hostPlatform _pkgs.wxGTK32;
description = ''
Enable wxWidgets interface.
'';
};
};
}
26 changes: 21 additions & 5 deletions pkgs/by-name/bo/bochs/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,29 @@
stdenv,
wget,
wxGTK32,
# Boolean flags
enableSDL2 ? true,
enableTerm ? true,
enableWx ? !stdenv.hostPlatform.isDarwin,
enableX11 ? !stdenv.hostPlatform.isDarwin,
_configuration ? {},
}:

let
eval = lib.evalModules {
modules = [
./options.nix
_configuration
{
_module.args = {
inherit stdenv;
_pkgs = {
inherit SDL2 ncurses wxGTK32 libX11;
};
};
}
];
};
enableSDL2 = eval.config.SDL2;
enableTerm = eval.config.term;
enableWx = eval.config.wx;
enableX11 = eval.config.X11;
in
stdenv.mkDerivation (finalAttrs: {
pname = "bochs";
version = "2.8";
Expand Down
Loading