Modularize libvirt

This commit is contained in:
jalr 2021-12-05 16:15:43 +00:00
parent 22f092e6e9
commit b236936061
5 changed files with 35 additions and 14 deletions

View file

@ -39,10 +39,8 @@
pavucontrol
redir
ripgrep
spice-gtk
tcpdump
usbutils
virt-manager
];
environment.variables.EDITOR = "nvim";
@ -78,7 +76,6 @@
virtualisation = {
docker.enable = true;
libvirtd.enable = true;
};
security.polkit.enable = true;
@ -86,6 +83,7 @@
myConfig = {
gui.enable = true;
sdr.enable = true;
libvirt.enable = true;
autologin.enable = true;
autologin.username = "jalr";
};

View file

@ -64,10 +64,8 @@
pavucontrol
redir
ripgrep
spice-gtk
tcpdump
usbutils
virt-manager
];
environment.variables.EDITOR = "nvim";
@ -96,12 +94,6 @@
virtualisation = {
docker.enable = true;
libvirtd = {
enable = true;
qemuOvmf = true;
onBoot = "ignore";
onShutdown = "shutdown";
};
};
#virtualisation.docker.extraOptions = "--dns 172.17.0.1";
@ -111,6 +103,7 @@
myConfig = {
gui.enable = true;
sdr.enable = false;
libvirt.enable = true;
autologin.enable = true;
autologin.username = "jal";
tradebyte.enable = true;

View file

@ -24,8 +24,6 @@
neovim
pavucontrol
ripgrep
spice-gtk
virt-manager
];
environment.variables.EDITOR = "nvim";
@ -70,7 +68,6 @@
virtualisation = {
docker.enable = true;
libvirtd.enable = true;
};
security.polkit.enable = true;
@ -78,6 +75,7 @@
myConfig = {
gui.enable = true;
sdr.enable = true;
libvirt.enable = true;
autologin.enable = true;
autologin.username = "jalr";
};

View file

@ -11,6 +11,7 @@
./fish.nix
./fonts.nix
./kvm-switch-enable-screen.nix
./libvirt.nix
./localization.nix
./mute-indicator.nix
./nix.nix

31
modules/libvirt.nix Normal file
View file

@ -0,0 +1,31 @@
{ config, lib, pkgs, ... }:
let
cfg = config.myConfig;
in
{
options.myConfig = {
libvirt = {
enable = pkgs.lib.mkEnableOption "Enable libvirt";
};
};
config = lib.mkIf cfg.libvirt.enable {
environment.systemPackages = with pkgs; [
spice-gtk
virt-manager
];
virtualisation = {
docker.enable = true;
libvirtd = {
enable = true;
qemu.ovmf.enable = true;
# start: starts all guests that were running prior to shutdown
# ignore: only start guests which are marked as autostart
onBoot = "ignore";
onShutdown = "shutdown";
};
};
};
}