From 5804ff31ff89b4a49d619860c4a3855ead73773f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Geoffrey=20=E2=80=9CFrogeye=E2=80=9D=20Preud=27homme?= Date: Tue, 1 Oct 2024 15:17:11 +0200 Subject: [PATCH] Convert Virtualbox to KVM --- cranberry/features.nix | 3 ++- curacao/features.nix | 8 +------- hm/dev/common.nix | 4 ++++ options.nix | 1 + os/dev/default.nix | 18 ++++++++++++++---- 5 files changed, 22 insertions(+), 12 deletions(-) diff --git a/cranberry/features.nix b/cranberry/features.nix index 36e930a..f2a796b 100644 --- a/cranberry/features.nix +++ b/cranberry/features.nix @@ -1,8 +1,9 @@ -{ pkgs, lib, config, ... }: +{ ... }: { config = { frogeye = { desktop.xorg = true; + dev.vm = true; extra = true; }; }; diff --git a/curacao/features.nix b/curacao/features.nix index cc6ae40..fa78240 100644 --- a/curacao/features.nix +++ b/curacao/features.nix @@ -6,16 +6,10 @@ }; dev = { docker = true; + vm = true; }; extra = true; gaming = true; storageSize = "big"; }; - - # Shenanigans - # nixpkgs.config.allowUnfree = true; - # virtualisation.virtualbox.host.enable = true; - # virtualisation.virtualbox.host.enableExtensionPack = true; - # users.extraGroups.vboxusers.members = [ "geoffrey" ]; - # TODO Convert Windows VM from virtualbox to libvirt } diff --git a/hm/dev/common.nix b/hm/dev/common.nix index f0e4628..1f4291a 100644 --- a/hm/dev/common.nix +++ b/hm/dev/common.nix @@ -54,6 +54,10 @@ ] ++ lib.optionals (config.frogeye.desktop.xorg && config.frogeye.dev.fpga) [ yosys gtkwave + + # VM (graphical) + ] ++ lib.optionals (config.frogeye.desktop.xorg && config.frogeye.dev.vm) [ + virt-manager ]; programs.nixvim.plugins.lsp.servers = { diff --git a/options.nix b/options.nix index 33654cf..5b7dbda 100644 --- a/options.nix +++ b/options.nix @@ -50,6 +50,7 @@ in php = lib.mkEnableOption "PHP dev stuff"; prose = lib.mkEnableOption "Writing stuff"; python = lib.mkEnableOption "Python dev stuff"; + vm = lib.mkEnableOption "Virtual machines"; }; storageSize = lib.mkOption { default = "small"; diff --git a/os/dev/default.nix b/os/dev/default.nix index 38cd79d..4311fd7 100644 --- a/os/dev/default.nix +++ b/os/dev/default.nix @@ -1,7 +1,17 @@ { pkgs, lib, config, ... }: { - config = lib.mkIf config.frogeye.dev.docker { - virtualisation.docker.enable = true; - users.users.geoffrey.extraGroups = [ "docker" ]; - }; + config = lib.mkMerge [ + (lib.mkIf config.frogeye.dev.docker { + virtualisation.docker.enable = true; + users.users.geoffrey.extraGroups = [ "docker" ]; + }) + (lib.mkIf config.frogeye.dev.vm { + virtualisation = { + libvirtd.enable = true; + spiceUSBRedirection.enable = true; + }; + users.extraGroups.libvirtd.members = [ "geoffrey" ]; + }) + + ]; }