Skip to content
This repository has been archived by the owner on Aug 27, 2018. It is now read-only.

Commit

Permalink
libvirtd-service: give access to users in the "libvirtd" group
Browse files Browse the repository at this point in the history
Currently only root has access. But with this patch all users in
"libvirtd" group will have access. This is similar to how it's done on
Ubuntu.

Also, add virtualisation.libvirtd.extraConfig option for further
customization of libvirtd.conf.
  • Loading branch information
bjornfor committed Aug 15, 2013
1 parent 2dca842 commit f7d11af
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion modules/virtualisation/libvirtd.nix
Expand Up @@ -7,6 +7,13 @@ with pkgs.lib;
let

cfg = config.virtualisation.libvirtd;
configFile = pkgs.writeText "libvirtd.conf" ''
unix_sock_group = "libvirtd"
unix_sock_rw_perms = "0770"
auth_unix_ro = "none"
auth_unix_rw = "none"
${cfg.extraConfig}
'';

in

Expand Down Expand Up @@ -36,6 +43,16 @@ in
'';
};

virtualisation.libvirtd.extraConfig =
mkOption {
default = "";
description =
''
Extra contents appended to the libvirtd configuration file,
libvirtd.conf.
'';
};

};


Expand Down Expand Up @@ -83,7 +100,7 @@ in
done
''; # */

serviceConfig.ExecStart = "@${pkgs.libvirt}/sbin/libvirtd libvirtd --daemon --verbose";
serviceConfig.ExecStart = ''@${pkgs.libvirt}/sbin/libvirtd libvirtd --config "${configFile}" --daemon --verbose'';
serviceConfig.Type = "forking";
serviceConfig.KillMode = "process"; # when stopping, leave the VMs alone

Expand Down Expand Up @@ -124,6 +141,8 @@ in
serviceConfig.RemainAfterExit = true;
};

users.extraGroups.libvirtd = {};

};

}

0 comments on commit f7d11af

Please sign in to comment.