mirror of
https://github.com/Stunkymonkey/nixos.git
synced 2025-05-24 09:54:40 +02:00
system/kvm: rename from virtualization
This commit is contained in:
parent
93cc7dcfc5
commit
2350dd913a
4 changed files with 8 additions and 8 deletions
40
modules/system/kvm/default.nix
Normal file
40
modules/system/kvm/default.nix
Normal file
|
@ -0,0 +1,40 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
let
|
||||
cfg = config.my.system.kvm;
|
||||
in
|
||||
{
|
||||
options.my.system.kvm = with lib; {
|
||||
enable = mkEnableOption "kvm configuration";
|
||||
|
||||
cpuFlavor = mkOption {
|
||||
type = with types; nullOr (enum [ "intel" "amd" ]);
|
||||
default = null;
|
||||
example = "intel";
|
||||
description = "Which kind of CPU to activate kernelModules";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable (lib.mkMerge [
|
||||
{
|
||||
virtualisation.libvirtd.enable = true;
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
virtmanager
|
||||
];
|
||||
}
|
||||
|
||||
# Intel CPU
|
||||
(lib.mkIf (cfg.cpuFlavor == "intel") {
|
||||
boot.kernelModules = [
|
||||
"kvm-intel"
|
||||
];
|
||||
})
|
||||
|
||||
# AMD CPU
|
||||
(lib.mkIf (cfg.cpuFlavor == "amd") {
|
||||
boot.kernelModules = [
|
||||
"kvm-amd"
|
||||
];
|
||||
})
|
||||
]);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue