forked from mirrors/nixpkgs
nixos/libvirt: Syntactic-only refactoring
This commit is contained in:
parent
301b4e9018
commit
a0c0f63811
|
@ -1,5 +1,3 @@
|
|||
# Systemd services for libvirtd.
|
||||
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
@ -16,19 +14,16 @@ let
|
|||
${cfg.extraConfig}
|
||||
'';
|
||||
|
||||
in
|
||||
in {
|
||||
|
||||
{
|
||||
###### interface
|
||||
|
||||
options = {
|
||||
|
||||
virtualisation.libvirtd.enable =
|
||||
mkOption {
|
||||
virtualisation.libvirtd.enable = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description =
|
||||
''
|
||||
description = ''
|
||||
This option enables libvirtd, a daemon that manages
|
||||
virtual machines. Users in the "libvirtd" group can interact with
|
||||
the daemon (e.g. to start or stop VMs) using the
|
||||
|
@ -36,44 +31,36 @@ in
|
|||
'';
|
||||
};
|
||||
|
||||
virtualisation.libvirtd.enableKVM =
|
||||
mkOption {
|
||||
virtualisation.libvirtd.enableKVM = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description =
|
||||
''
|
||||
description = ''
|
||||
This option enables support for QEMU/KVM in libvirtd.
|
||||
'';
|
||||
};
|
||||
|
||||
virtualisation.libvirtd.extraConfig =
|
||||
mkOption {
|
||||
virtualisation.libvirtd.extraConfig = mkOption {
|
||||
type = types.lines;
|
||||
default = "";
|
||||
description =
|
||||
''
|
||||
description = ''
|
||||
Extra contents appended to the libvirtd configuration file,
|
||||
libvirtd.conf.
|
||||
'';
|
||||
};
|
||||
|
||||
virtualisation.libvirtd.extraOptions =
|
||||
mkOption {
|
||||
virtualisation.libvirtd.extraOptions = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ ];
|
||||
example = [ "--verbose" ];
|
||||
description =
|
||||
''
|
||||
description = ''
|
||||
Extra command line arguments passed to libvirtd on startup.
|
||||
'';
|
||||
};
|
||||
|
||||
virtualisation.libvirtd.onShutdown =
|
||||
mkOption {
|
||||
virtualisation.libvirtd.onShutdown = mkOption {
|
||||
type = types.enum ["shutdown" "suspend" ];
|
||||
default = "suspend";
|
||||
description =
|
||||
''
|
||||
description = ''
|
||||
When shutting down / restarting the host what method should
|
||||
be used to gracefully halt the guests. Setting to "shutdown"
|
||||
will cause an ACPI shutdown of each guest. "suspend" will
|
||||
|
@ -81,7 +68,6 @@ in
|
|||
'';
|
||||
};
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@ -95,8 +81,10 @@ in
|
|||
|
||||
boot.kernelModules = [ "tun" ];
|
||||
|
||||
systemd.services.libvirtd =
|
||||
{ description = "Libvirt Virtual Machine Management Daemon";
|
||||
users.extraGroups.libvirtd.gid = config.ids.gids.libvirtd;
|
||||
|
||||
systemd.services.libvirtd = {
|
||||
description = "Libvirt Virtual Machine Management Daemon";
|
||||
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
after = [ "systemd-udev-settle.service" ]
|
||||
|
@ -111,8 +99,7 @@ in
|
|||
++ optional cfg.enableKVM pkgs.qemu_kvm
|
||||
++ optional vswitch.enable vswitch.package;
|
||||
|
||||
preStart =
|
||||
''
|
||||
preStart = ''
|
||||
mkdir -p /var/log/libvirt/qemu -m 755
|
||||
rm -f /var/run/libvirtd.pid
|
||||
|
||||
|
@ -176,8 +163,5 @@ in
|
|||
description = "Virtual machine lock manager";
|
||||
serviceConfig.ExecStart = "@${pkgs.libvirt}/sbin/virtlockd virtlockd";
|
||||
};
|
||||
|
||||
users.extraGroups.libvirtd.gid = config.ids.gids.libvirtd;
|
||||
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue