1
1
Fork 0

libvirt: use env var to specify uri

Signed-off-by: Myned <dev@bjork.tech>
This commit is contained in:
Myned 2024-09-11 18:18:41 -05:00
parent a71db4c9d8
commit 3705c2e818
Signed by: myned
GPG key ID: C7224454F7881A34
4 changed files with 11 additions and 16 deletions

View file

@ -340,7 +340,7 @@ in {
text = ''
#! /usr/bin/env ${bash}
case "$(virsh --connect qemu:///system domstate myndows)" in
case "$(virsh domstate myndows)" in
'running')
${echo}
${echo} Online

View file

@ -3,8 +3,6 @@
# Start/resume VM if needed and launch viewer
#?? man xfreerdp
function virsh() { command virsh --connect qemu:///system "$@"; }
state="$(virsh domstate myndows)"
if [[ "$state" == 'paused' ]]; then

View file

@ -149,12 +149,6 @@ in
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" = {
auto-redirect = mkBoolean false;
resize-guest = mkInt32 1;

View file

@ -19,13 +19,6 @@ in
};
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 = {
# https://wiki.nixos.org/wiki/Libvirt
# 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 {
# Fix resume messages polluting tty
services.libvirt-guests.serviceConfig.StandardOutput = "journal";