Skip to content

Commit ae18bf0

Browse files
hardware: add the hardware type
choose between server/laptop/desktop Signed-off-by: Brian McGillion <bmg.avoin@gmail.com>
1 parent 690aadb commit ae18bf0

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

modules/hardware/common/qemu.nix

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,16 @@ in
2828
config = {
2929
ghaf.qemu.guivm = optionalAttrs (hasAttr "hardware" config.ghaf) {
3030
microvm.qemu.extraArgs =
31-
[
31+
optionals (config.ghaf.hardware.definition.type == "laptop") [
3232
# Button
33-
#"-device"
34-
#"button"
33+
"-device"
34+
"button"
3535
# Battery
36-
#"-device"
37-
#"battery"
36+
"-device"
37+
"battery"
3838
# AC adapter
39-
#"-device"
40-
#"acad"
39+
"-device"
40+
"acad"
4141
]
4242
++ optionals (hasAttr "yubikey" config.ghaf.hardware.usb.external.qemuExtraArgs) config.ghaf.hardware.usb.external.qemuExtraArgs.yubikey
4343
++ optionals (hasAttr "msKBD" config.ghaf.hardware.usb.external.qemuExtraArgs) config.ghaf.hardware.usb.external.qemuExtraArgs.msKBD

modules/hardware/definition.nix

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,12 @@ in
172172
default = [ ];
173173
};
174174

175+
type = mkOption {
176+
description = "Type of hardware (laptop, desktop, server)";
177+
type = types.str;
178+
default = "laptop";
179+
};
180+
175181
host = {
176182
kernelConfig = mkOption {
177183
description = "Host kernel configuration";

modules/reference/hardware/demo-tower/demo-tower.nix

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
# List of system SKUs covered by this configuration
88
skus = [ "Be Quiet mk1" ];
99

10+
type = "desktop";
11+
1012
# Host configuration xhci_pci was blacklisted
1113
host = {
1214
kernelConfig.kernelParams = [

0 commit comments

Comments
 (0)