diff --git a/hosts/pinwheel/configuration.nix b/hosts/pinwheel/configuration.nix index 981ad5d..a874864 100644 --- a/hosts/pinwheel/configuration.nix +++ b/hosts/pinwheel/configuration.nix @@ -56,8 +56,6 @@ LC_TIME = "en_US.UTF-8"; }; - programs.dconf.enable = true; - # Define a user account. Don't forget to set a password with ‘passwd’. users.users.alex = { isNormalUser = true; @@ -90,6 +88,7 @@ keyboard.enable = true; docker.enable = true; podman.enable = false; + vm.enable = true; scripts.enable = true; }; diff --git a/hosts/pinwheel/modules/vm/default.nix b/hosts/pinwheel/modules/vm/default.nix new file mode 100644 index 0000000..f766938 --- /dev/null +++ b/hosts/pinwheel/modules/vm/default.nix @@ -0,0 +1,33 @@ +{ pkgs, lib, config, ... }: +let + enabled = config.mod.vm.enable; +in +{ + options = { + mod.vm = { + enable = lib.mkEnableOption "add vm module"; + }; + }; + + config = lib.mkIf enabled { + virtualisation.libvirtd.enable = true; + + users.users.alex = { + extraGroups = [ "libvirtd" ]; + }; + + environment.systemPackages = with pkgs; [ virt-manager ]; + + # virt-manager requires dconf to remember settings + programs.dconf.enable = true; + + home-manager.users.alex = { + dconf.settings = { + "org/virt-manager/virt-manager/connections" = { + autoconnect = ["qemu:///system"]; + uris = ["qemu:///system"]; + }; + }; + }; + }; +}