From 15c041208098664c52620c8ec00b263eca113db1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20B=C3=A4dorf?= Date: Sat, 11 Dec 2021 21:08:20 +0100 Subject: [PATCH] Add looking glass for VMs, switch from scream-ivshmem to qemu-pulse --- modules/gaming/default.nix | 2 +- modules/virtualisation/default.nix | 17 +++++++++--- ...e.service.nix => scream-pulse.service.nix} | 0 overlays/overrides.nix | 4 ++- pkgs/default.nix | 27 ++++++++++--------- pkgs/lgcl.nix | 3 +++ 6 files changed, 35 insertions(+), 18 deletions(-) rename modules/virtualisation/{scream-ivshmem-pulse.service.nix => scream-pulse.service.nix} (100%) create mode 100644 pkgs/lgcl.nix diff --git a/modules/gaming/default.nix b/modules/gaming/default.nix index b9616e63..00939e82 100644 --- a/modules/gaming/default.nix +++ b/modules/gaming/default.nix @@ -20,7 +20,7 @@ in playonlinux godot obs-studio - obs-wlrobs + obs-studio-plugins.wlrobs ]; }; }; diff --git a/modules/virtualisation/default.nix b/modules/virtualisation/default.nix index c97db9d2..4d588622 100644 --- a/modules/virtualisation/default.nix +++ b/modules/virtualisation/default.nix @@ -3,6 +3,8 @@ with lib; let psCfg = config.pub-solar; cfg = config.pub-solar.virtualisation; + doesGaming = config.pub-solar.gaming.enable; + extraObsPlugins = if doesGaming then [ pkgs.obs-studio-plugins.looking-glass-obs ] else [ ]; in { options.pub-solar.virtualisation = { @@ -32,17 +34,26 @@ in virt-manager python38Packages.libvirt gvfs - scream edk2 OVMF win-virtio + looking-glass-client + lgcl ]; home-manager = with pkgs; pkgs.lib.setAttrByPath [ "users" psCfg.user.name ] { xdg.dataFile."libvirt/.keep".text = "# this file is here to generate the directory"; + home.packages = extraObsPlugins; }; - systemd.tmpfiles.rules = [ "f /dev/shm/scream-ivshmem 0660 ${psCfg.user.name} kvm" ]; - systemd.user.services.scream-ivshmem-pulse = import ./scream-ivshmem-pulse.service.nix pkgs; + systemd.tmpfiles.rules = [ + "f /dev/shm/looking-glass 0660 ${psCfg.user.name} kvm" + ]; + networking.bridges.virbr1.interfaces = [ ]; + networking.interfaces.virbr1 = { + ipv4.addresses = [ + { address = "192.168.123.1"; prefixLength = 24; } + ]; + }; }; } diff --git a/modules/virtualisation/scream-ivshmem-pulse.service.nix b/modules/virtualisation/scream-pulse.service.nix similarity index 100% rename from modules/virtualisation/scream-ivshmem-pulse.service.nix rename to modules/virtualisation/scream-pulse.service.nix diff --git a/overlays/overrides.nix b/overlays/overrides.nix index b2049d20..dc2189bc 100644 --- a/overlays/overrides.nix +++ b/overlays/overrides.nix @@ -16,12 +16,14 @@ channels: final: prev: { qutebrowser signal-desktop tdesktop - obs-studio starship deploy-rs xdg-desktop-portal xdg-desktop-portal-gtk xdg-desktop-portal-wlr + obs-studio + obs-studio-plugins + looking-glass-client ; haskellPackages = prev.haskellPackages.override diff --git a/pkgs/default.nix b/pkgs/default.nix index a096f93e..312e685f 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -1,18 +1,19 @@ final: prev: - with final; { +with final; { # keep sources this first sources = prev.callPackage (import ./_sources/generated.nix) { }; # then, call packages with `final.callPackage` - import-gtk-settings = writeShellScriptBin "import-gtk-settings" (import ./import-gtk-settings.nix final); - mailto-mutt = writeShellScriptBin "mailto-mutt" (import ./mailto-mutt.nix final); - mopidy-jellyfin = import ./mopidy-jellyfin.nix final; - mu = writeShellScriptBin "mu" (import ./mu.nix final); - psos = writeShellScriptBin "psos" (import ./psos.nix final); - s = writeShellScriptBin "s" (import ./s.nix final); - sway-launcher = writeScriptBin "sway-launcher" (import ./sway-launcher.nix final); - sway-service = writeShellScriptBin "sway-service" (import ./sway-service.nix final); - swaylock-bg = writeScriptBin "swaylock-bg" (import ./swaylock-bg.nix final); - toggle-kbd-layout = writeShellScriptBin "toggle-kbd-layout" (import ./toggle-kbd-layout.nix final); - uhk-agent = import ./uhk-agent.nix final; - wcwd = writeShellScriptBin "wcwd" (import ./wcwd.nix final); + import-gtk-settings = writeShellScriptBin "import-gtk-settings" (import ./import-gtk-settings.nix final); + lgcl = writeShellScriptBin "lgcl" (import ./lgcl.nix final); + mailto-mutt = writeShellScriptBin "mailto-mutt" (import ./mailto-mutt.nix final); + mopidy-jellyfin = import ./mopidy-jellyfin.nix final; + mu = writeShellScriptBin "mu" (import ./mu.nix final); + psos = writeShellScriptBin "psos" (import ./psos.nix final); + s = writeShellScriptBin "s" (import ./s.nix final); + sway-launcher = writeScriptBin "sway-launcher" (import ./sway-launcher.nix final); + sway-service = writeShellScriptBin "sway-service" (import ./sway-service.nix final); + swaylock-bg = writeScriptBin "swaylock-bg" (import ./swaylock-bg.nix final); + toggle-kbd-layout = writeShellScriptBin "toggle-kbd-layout" (import ./toggle-kbd-layout.nix final); + uhk-agent = import ./uhk-agent.nix final; + wcwd = writeShellScriptBin "wcwd" (import ./wcwd.nix final); } diff --git a/pkgs/lgcl.nix b/pkgs/lgcl.nix new file mode 100644 index 00000000..4ef2dac9 --- /dev/null +++ b/pkgs/lgcl.nix @@ -0,0 +1,3 @@ +self: with self; '' + ${self.looking-glass-client}/bin/looking-glass-client -f /dev/shm/looking-glass input:ignoreWindowsKeys=yes input:grabKeyboardOnFocus=no +''