2021-09-29 02:24:03 +00:00
|
|
|
{ config, pkgs, lib, modulesPath, ... }:
|
|
|
|
let
|
|
|
|
|
|
|
|
inherit (pkgs) callPackage;
|
|
|
|
|
|
|
|
hardwareFor = name: cfg: lib.mkIf (config.sconfig.hardware == name) cfg;
|
|
|
|
|
|
|
|
hardwareModules =
|
|
|
|
[
|
|
|
|
(hardwareFor "qemu"
|
|
|
|
{
|
|
|
|
inherit (callPackage "${modulesPath}/profiles/qemu-guest.nix" { }) boot;
|
|
|
|
services.qemuGuest.enable = true;
|
|
|
|
})
|
|
|
|
|
|
|
|
(hardwareFor "vmware"
|
|
|
|
{
|
|
|
|
virtualisation.vmware.guest.enable = true;
|
|
|
|
boot.initrd.availableKernelModules = [ "mptspi" ];
|
|
|
|
})
|
|
|
|
|
|
|
|
(hardwareFor "physical"
|
|
|
|
{
|
|
|
|
inherit (callPackage "${modulesPath}/installer/scan/not-detected.nix" { }) hardware;
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
|
|
|
in
|
|
|
|
with lib;
|
|
|
|
{
|
|
|
|
options.sconfig.hardware = mkOption {
|
|
|
|
type = types.enum [ "physical" "vmware" "qemu" ];
|
|
|
|
};
|
|
|
|
|
2021-09-30 04:06:49 +00:00
|
|
|
config = mkMerge hardwareModules;
|
2021-09-29 02:24:03 +00:00
|
|
|
}
|