From dacf1e1fe80a0257db40480ae48f0f6e098c000e Mon Sep 17 00:00:00 2001 From: materus Date: Thu, 31 Aug 2023 11:01:38 +0200 Subject: [PATCH] configurations: update --- .../host/flamaster/configuration.nix | 4 +- .../host/materusPC/hardware/default.nix | 2 +- configurations/host/materusPC/tmp.nix | 15 +-- configurations/host/materusPC/vm/default.nix | 36 +----- .../host/materusPC/vm/win10/default.nix | 115 +++++++++++------- configurations/profile/home/browser.nix | 4 +- configurations/profile/home/shell/zsh.nix | 4 +- configurations/profile/os/games/steam.nix | 6 +- 8 files changed, 91 insertions(+), 95 deletions(-) diff --git a/configurations/host/flamaster/configuration.nix b/configurations/host/flamaster/configuration.nix index 57eb973..e3e2c13 100644 --- a/configurations/host/flamaster/configuration.nix +++ b/configurations/host/flamaster/configuration.nix @@ -157,9 +157,9 @@ services.openssh.enable = true; # Open ports in the firewall. - networking.firewall.allowedTCPPorts = [ 22 27015 25565 24454 ]; + networking.firewall.allowedTCPPorts = [ 22 27015 25565 24454 8123 ]; networking.firewall.allowedTCPPortRanges = [{ from = 16262; to = 16272; }]; - networking.firewall.allowedUDPPorts = [ 22 16261 16262 8766 8767 25565 24454 ]; + networking.firewall.allowedUDPPorts = [ 22 16261 16262 8766 8767 25565 24454 8123 ]; # Or disable the firewall altogether. networking.firewall.enable = true; diff --git a/configurations/host/materusPC/hardware/default.nix b/configurations/host/materusPC/hardware/default.nix index 0d157e4..ce56c41 100644 --- a/configurations/host/materusPC/hardware/default.nix +++ b/configurations/host/materusPC/hardware/default.nix @@ -16,7 +16,7 @@ in hardware.firmware = with pkgs; [ materusPkgs.amdgpu-pro-libs.firmware.vcn materusPkgs.amdgpu-pro-libs.firmware - pkg.linux-firmware + linux-firmware alsa-firmware sof-firmware ]; diff --git a/configurations/host/materusPC/tmp.nix b/configurations/host/materusPC/tmp.nix index 5e69c85..31808a1 100644 --- a/configurations/host/materusPC/tmp.nix +++ b/configurations/host/materusPC/tmp.nix @@ -1,8 +1,8 @@ { config, pkgs, lib, inputs, materusFlake, materusPkgs, ... }: { - virtualisation.lxc.enable = true; - virtualisation.lxc.lxcfs.enable = true; - virtualisation.lxd.enable = true; + virtualisation.lxc.enable = false; + virtualisation.lxc.lxcfs.enable = false; + virtualisation.lxd.enable = false; #virtualisation.lxd.recommendedSysctlSettings = true; programs.corectrl.enable = true; @@ -83,7 +83,7 @@ services.xserver.libinput.enable = true; - virtualisation.waydroid.enable = true; + virtualisation.waydroid.enable = false; virtualisation.podman = { enable = true; #enableNvidia = true; @@ -220,7 +220,7 @@ aspellDicts.pl aspellDicts.en aspellDicts.en-computers - + steamtinkerlaunch distrobox p7zip @@ -302,10 +302,7 @@ - system.activationScripts.libvirt-hooks.text = - '' - ln -Tfs /etc/libvirt/hooks /var/lib/libvirt/hooks - ''; + diff --git a/configurations/host/materusPC/vm/default.nix b/configurations/host/materusPC/vm/default.nix index 800a71e..9604975 100644 --- a/configurations/host/materusPC/vm/default.nix +++ b/configurations/host/materusPC/vm/default.nix @@ -4,40 +4,6 @@ ./win10 ]; - system.activationScripts.libvirt-hooks.text = - '' - ln -Tfs /etc/libvirt/hooks /var/lib/libvirt/hooks - ''; - environment.etc."libvirt/hooks/qemu" = { - text = - '' - #!${pkgs.bash}/bin/bash - GUEST_NAME="''$1" - HOOK_NAME="''$2" - STATE_NAME="''$3" - MISC="''${@:4}" - - BASEDIR="''$(dirname ''$0)" - - HOOKPATH="''$BASEDIR/qemu.d/''$GUEST_NAME/''$HOOK_NAME/''$STATE_NAME" - - set -e # If a script exits with an error, we should as well. - - # check if it's a non-empty executable file - if [ -f "''$HOOKPATH" ] && [ -s "''$HOOKPATH"] && [ -x "''$HOOKPATH" ]; then - eval \"''$HOOKPATH\" "$@" - elif [ -d "''$HOOKPATH" ]; then - while read file; do - # check for null string - if [ ! -z "''$file" ]; then - eval \"''$file\" "''$@" - fi - done <<< "''$(find -L "''$HOOKPATH" -maxdepth 1 -type f -executable -print;)" - fi - ''; - mode = "0755"; - }; - virtualisation.libvirtd = { enable = true; @@ -50,6 +16,8 @@ qemu.package = pkgs.qemu_full; }; + virtualisation.spiceUSBRedirection.enable = true; + environment.systemPackages = with pkgs; [ virtiofsd config.virtualisation.libvirtd.qemu.package diff --git a/configurations/host/materusPC/vm/win10/default.nix b/configurations/host/materusPC/vm/win10/default.nix index c03da0f..a9567ef 100644 --- a/configurations/host/materusPC/vm/win10/default.nix +++ b/configurations/host/materusPC/vm/win10/default.nix @@ -1,63 +1,90 @@ { config, pkgs, lib, inputs, materusFlake, ... }: +let + startHook = '' + # Debugging + # exec 19>/home/materus/startlogfile + # BASH_XTRACEFD=19 + # set -x + + # exec 3>&1 4>&2 + # trap 'exec 2>&4 1>&3' 0 1 2 3 + # exec 1>/home/materus/startlogfile.out 2>&1 + + + systemctl stop mountWin10Share.service + sleep 1s + + echo ''$VIRSH_GPU_VIDEO > "/sys/bus/pci/devices/''${VIRSH_GPU_VIDEO}/driver/unbind" + echo ''$VIRSH_GPU_AUDIO > "/sys/bus/pci/devices/''${VIRSH_GPU_AUDIO}/driver/unbind" + + sleep 1s + + echo "8" > "/sys/bus/pci/devices/''${VIRSH_GPU_VIDEO}/resource0_resize" + echo "1" > "/sys/bus/pci/devices/''${VIRSH_GPU_VIDEO}/resource2_resize" + + + ''; + stopHook = '' + + # Debugging + # exec 19>/home/materus/stoplogfile + # BASH_XTRACEFD=19 + # set -x + + # exec 3>&1 4>&2 + # trap 'exec 2>&4 1>&3' 0 1 2 3 + # exec 1>/home/materus/stoplogfile.out 2>&1 + + + + + echo ''$VIRSH_GPU_VIDEO > "/sys/bus/pci/devices/''${VIRSH_GPU_VIDEO}/driver/unbind" + echo ''$VIRSH_GPU_AUDIO > "/sys/bus/pci/devices/''${VIRSH_GPU_AUDIO}/driver/unbind" + + + sleep 1s + + echo "15" > "/sys/bus/pci/devices/''${VIRSH_GPU_VIDEO}/resource0_resize" + echo "8" > "/sys/bus/pci/devices/''${VIRSH_GPU_VIDEO}/resource2_resize" + + echo ''$VIRSH_GPU_VIDEO > /sys/bus/pci/drivers/amdgpu/bind + echo ''$VIRSH_GPU_AUDIO > /sys/bus/pci/drivers/snd_hda_intel/bind + + + systemctl start mountWin10Share.service + + ''; +in { - environment.etc = { - "libvirt/hooks/kvm.conf" = { - text = - '' - VIRSH_GPU_VIDEO="0000:03:00.0" - VIRSH_GPU_AUDIO="0000:03:00.1" - ''; - mode = "0755"; - }; - "libvirt/hooks/qemu.d/win10/prepare/begin/start.sh" = { - text = '' - #!${pkgs.bash}/bin/bash - source /etc/libvirt/hooks/kvm.conf - systemctl stop mountWin10Share.service - echo ''$VIRSH_GPU_VIDEO > "/sys/bus/pci/devices/''${VIRSH_GPU_VIDEO}/driver/unbind" - echo ''$VIRSH_GPU_AUDIO > "/sys/bus/pci/devices/''${VIRSH_GPU_AUDIO}/driver/unbind" - sleep 1s - echo "8" > "/sys/bus/pci/devices/''${VIRSH_GPU_VIDEO}/resource0_resize" - echo "1" > "/sys/bus/pci/devices/''${VIRSH_GPU_VIDEO}/resource2_resize" + virtualisation.libvirtd.hooks.qemu = { + "win10" = pkgs.writeShellScript "win10.sh" '' + VIRSH_GPU_VIDEO="0000:03:00.0" + VIRSH_GPU_AUDIO="0000:03:00.1" + VIRSH_USB1="0000:10:00.0" - ''; - mode = "0755"; - }; + if [ ''$1 = "win10" ]; then + if [ ''$2 = "prepare" ] && [ ''$3 = "begin" ]; then + ${startHook} + fi - "libvirt/hooks/qemu.d/win10/release/end/stop.sh" = { - text = '' - #!${pkgs.bash}/bin/bash - source /etc/libvirt/hooks/kvm.conf + if [ ''$2 = "release" ] && [ ''$3 = "end" ]; then + ${stopHook} + fi - + fi - echo ''$VIRSH_GPU_VIDEO > "/sys/bus/pci/devices/''${VIRSH_GPU_VIDEO}/driver/unbind" - echo ''$VIRSH_GPU_AUDIO > "/sys/bus/pci/devices/''${VIRSH_GPU_AUDIO}/driver/unbind" - - sleep 1s - - echo "15" > "/sys/bus/pci/devices/''${VIRSH_GPU_VIDEO}/resource0_resize" - echo "8" > "/sys/bus/pci/devices/''${VIRSH_GPU_VIDEO}/resource2_resize" - - echo ''$VIRSH_GPU_VIDEO > /sys/bus/pci/drivers/amdgpu/bind - echo ''$VIRSH_GPU_AUDIO > /sys/bus/pci/drivers/snd_hda_intel/bind - - systemctl start mountWin10Share.service - - ''; - mode = "0755"; - }; + + ''; }; - systemd.services.mountWin10Share = { wantedBy = [ "multi-user.target" ]; path = [ config.virtualisation.libvirtd.qemu.package pkgs.util-linux pkgs.kmod pkgs.coreutils ]; diff --git a/configurations/profile/home/browser.nix b/configurations/profile/home/browser.nix index 085d43d..4752cd6 100644 --- a/configurations/profile/home/browser.nix +++ b/configurations/profile/home/browser.nix @@ -6,8 +6,8 @@ in options= let mkBoolOpt = materusPkgs.lib.mkBoolOpt; in{ materus.profile.browser.firefox.enable = mkBoolOpt config.materus.profile.enableDesktop "Enable Firefox with materus cfg"; - materus.profile.browser.vivaldi.enable = mkBoolOpt false "Enable Vivaldi with materus cfg"; - materus.profile.browser.brave.enable = mkBoolOpt config.materus.profile.enableDesktop "Enable Brave with materus cfg"; + materus.profile.browser.vivaldi.enable = mkBoolOpt config.materus.profile.enableDesktop "Enable Vivaldi with materus cfg"; + materus.profile.browser.brave.enable = mkBoolOpt false "Enable Brave with materus cfg"; }; #TODO: Make some config diff --git a/configurations/profile/home/shell/zsh.nix b/configurations/profile/home/shell/zsh.nix index fae6824..c2f3154 100644 --- a/configurations/profile/home/shell/zsh.nix +++ b/configurations/profile/home/shell/zsh.nix @@ -1,4 +1,4 @@ -{ config, pkgs, lib, materusFlake, materusPkgs, ... }: +{ config, pkgs, lib, materusFlake, materusPkgs, options, ... }: let p10kcfg = "${zshcfg}/p10kcfg"; zshcfg = "${materusFlake.path}/extraFiles/config/zsh"; @@ -22,7 +22,7 @@ in programs.zsh = { enable = true; enableAutosuggestions = true; - syntaxHighlighting.enable = true; + enableSyntaxHighlighting = true; enableVteIntegration = true; historySubstringSearch.enable = true; historySubstringSearch.searchUpKey = ";5A"; diff --git a/configurations/profile/os/games/steam.nix b/configurations/profile/os/games/steam.nix index c6bbbd0..a06c774 100644 --- a/configurations/profile/os/games/steam.nix +++ b/configurations/profile/os/games/steam.nix @@ -27,8 +27,12 @@ let pkgs.xorg.xcbutilerrors pkgs.xorg.xcbutilrenderutil pkgs.xorg.xcbutil + pkgs.xorg.xwininfo + pkgs.yad + pkgs.xdotool pkgs.libinput pkgs.openvdb + pkgs.openssl pkgs.tbb_2021_8 pkgs.gtk4 pkgs.gtk3 @@ -42,7 +46,7 @@ let pkgs.tdb pkgs.jbig2enc pkgs.jbig2dec - pkgs.brave + pkgs.vivaldi ] ++ config.materus.profile.packages.list.fonts;