libvirt: use env var to specify uri
Signed-off-by: Myned <dev@bjork.tech>
This commit is contained in:
parent
a71db4c9d8
commit
3705c2e818
4 changed files with 11 additions and 16 deletions
|
@ -340,7 +340,7 @@ in {
|
||||||
text = ''
|
text = ''
|
||||||
#! /usr/bin/env ${bash}
|
#! /usr/bin/env ${bash}
|
||||||
|
|
||||||
case "$(virsh --connect qemu:///system domstate myndows)" in
|
case "$(virsh domstate myndows)" in
|
||||||
'running')
|
'running')
|
||||||
${echo}
|
${echo}
|
||||||
${echo} Online
|
${echo} Online
|
||||||
|
|
|
@ -3,8 +3,6 @@
|
||||||
# Start/resume VM if needed and launch viewer
|
# Start/resume VM if needed and launch viewer
|
||||||
#?? man xfreerdp
|
#?? man xfreerdp
|
||||||
|
|
||||||
function virsh() { command virsh --connect qemu:///system "$@"; }
|
|
||||||
|
|
||||||
state="$(virsh domstate myndows)"
|
state="$(virsh domstate myndows)"
|
||||||
|
|
||||||
if [[ "$state" == 'paused' ]]; then
|
if [[ "$state" == 'paused' ]]; then
|
||||||
|
|
|
@ -149,12 +149,6 @@ in
|
||||||
forcepoweroff = mkBoolean false;
|
forcepoweroff = mkBoolean false;
|
||||||
};
|
};
|
||||||
|
|
||||||
"org/virt-manager/virt-manager/connections" = {
|
|
||||||
#?? [as]
|
|
||||||
autoconnect = mkArray type.string [ "qemu:///system" ];
|
|
||||||
uris = mkArray type.string [ "qemu:///system" ];
|
|
||||||
};
|
|
||||||
|
|
||||||
"org/virt-manager/virt-manager/console" = {
|
"org/virt-manager/virt-manager/console" = {
|
||||||
auto-redirect = mkBoolean false;
|
auto-redirect = mkBoolean false;
|
||||||
resize-guest = mkInt32 1;
|
resize-guest = mkInt32 1;
|
||||||
|
|
|
@ -19,13 +19,6 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
# https://github.com/virt-manager/virt-manager
|
|
||||||
programs.virt-manager.enable = cfg.libvirt;
|
|
||||||
|
|
||||||
users.users.${config.custom.username}.extraGroups =
|
|
||||||
lib.optionals cfg.libvirt [ "libvirtd" ]
|
|
||||||
++ lib.optionals cfg.virtualbox [ "vboxusers" ];
|
|
||||||
|
|
||||||
virtualisation = {
|
virtualisation = {
|
||||||
# https://wiki.nixos.org/wiki/Libvirt
|
# https://wiki.nixos.org/wiki/Libvirt
|
||||||
# https://libvirt.org
|
# https://libvirt.org
|
||||||
|
@ -76,6 +69,16 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# https://github.com/virt-manager/virt-manager
|
||||||
|
programs.virt-manager.enable = cfg.libvirt;
|
||||||
|
|
||||||
|
# https://libvirt.org/uri.html#default-uri-choice
|
||||||
|
environment.sessionVariables.LIBVIRT_DEFAULT_URI = mkIf cfg.libvirt "qemu:///system";
|
||||||
|
|
||||||
|
users.users.${config.custom.username}.extraGroups =
|
||||||
|
lib.optionals cfg.libvirt ["libvirtd"]
|
||||||
|
++ lib.optionals cfg.virtualbox ["vboxusers"];
|
||||||
|
|
||||||
systemd = mkIf cfg.libvirt {
|
systemd = mkIf cfg.libvirt {
|
||||||
# Fix resume messages polluting tty
|
# Fix resume messages polluting tty
|
||||||
services.libvirt-guests.serviceConfig.StandardOutput = "journal";
|
services.libvirt-guests.serviceConfig.StandardOutput = "journal";
|
||||||
|
|
Loading…
Reference in a new issue