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

nixos/virtualbox-image: add params #80736

Merged
merged 1 commit into from Feb 22, 2020
Merged

nixos/virtualbox-image: add params #80736

merged 1 commit into from Feb 22, 2020

Conversation

mmahut
Copy link
Member

@mmahut mmahut commented Feb 21, 2020

Motivation for this change

The following change allows users to redefine the default parameters that are being passed to the VirtualBox appliance.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@mmahut
Copy link
Member Author

mmahut commented Feb 21, 2020

@GrahamcOfBorg test virtualbox

Copy link
Member

@lukateras lukateras left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, thank you so much <3

example = {
audio = "alsa";
rtcuseutc = "on";
usb = "off";
Copy link
Member

@lukateras lukateras Feb 21, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might make sense to be able to specify usb = false; and have that converted to --usb=off on its own, which is a small detour from lib.cli.toGNUCommandLine behavior.

(This is obviously a reverse compatible change and can be addressed later if desired).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, good point. Let me find out how that is possible.

@lukateras
Copy link
Member

lukateras commented Feb 21, 2020

I'm inclined to merge this as-is and will do so later today unless anyone feels otherwise :)

@lukateras
Copy link
Member

lukateras commented Feb 21, 2020

CC @aszlig as someone who might be interested in this change.

@lukateras
Copy link
Member

I've implemented { usb = false; } => --usb off separately in #80807.

@mmahut
Copy link
Member Author

mmahut commented Feb 22, 2020

Oh, I had a prototype in works. Something like this, for inspiration.

nix-repl> let mkBool = k: v: if v then let renderV = if v then "on" else "off";                            
          in if builtins.stringLength k == 1 then ["-${k} ${renderV}"] else ["--${k} ${renderV}"] else [];
          in lib.cli.toGNUCommandLineShell { mkBool = mkBool; } cfg.params                                       
"'--acpi on' '--audio' 'alsa' '--audiocontroller' 'ac97' '--audioout' 'on' '--mouse' 'usbtablet' '--nic1' 'nat' '--nictype1' 'virtio' '--rtcuseutc' 'on' '--usb' 'on' '--usbehci' 'on' '--vram' '32'"

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.

None yet

2 participants