diff --git a/configuration/hosts/samhain/configuration.nix b/configuration/hosts/samhain/configuration.nix index 3fc8c26c..ae09ad3a 100644 --- a/configuration/hosts/samhain/configuration.nix +++ b/configuration/hosts/samhain/configuration.nix @@ -5,7 +5,6 @@ ./hardware-configuration.nix ../../profiles/common ../../profiles/desktop - #../../profiles/gnome ../../profiles/xfce ../../profiles/gaming ../../profiles/development @@ -20,18 +19,77 @@ boot.loader.efi.canTouchEfiVariables = true; boot.supportedFilesystems = [ "zfs" "xfs" ]; + # video=efifb:off allows the 580 to be passed through regardless of being the boot display and allows the 560 to act as a console device + # pci=noats means that it doesn't kernel panic on my specific configuration + boot.kernelParams = [ + "amd_iommu=on" + "pci=noats" + "video=efifb:off" + ]; # eventually switch to vfio-pci.ids to replace the boot.initrd.preDeviceCommands block + boot.initrd.availableKernelModules = + [ "amdgpu" "vfio-pci" ]; # vfio-pci is required for pci passthrough + boot.kernelModules = + [ "i2c-dev" "kvm-amd" ]; # i2c-dev is required for DDC/CI for screenstub + + # the script provided: https://alexbakker.me/post/nixos-pci-passthrough-qemu-vfio.html can be used to find iommu groups + boot.initrd.preDeviceCommands = '' + DEVS="0000:26:00.0 0000:26:00.1" + for DEV in $DEVS; do + echo "vfio-pci" > /sys/bus/pci/devices/$DEV/driver_override + done + modprobe -i vfio-pci + ''; + + nixpkgs.config.packageOverrides = pkgs: { + nur = import (builtins.fetchTarball + "https://github.com/nix-community/NUR/archive/master.tar.gz") { + inherit pkgs; + }; + }; + + environment.systemPackages = [ + pkgs.nur.repos.arc.packages.screenstub # for DDC/CI and input forwarding + pkgs.nur.repos.arc.packages.scream-arc # for audio forwarding + pkgs.ddcutil # for diagnostics on DDC/CI + pkgs.virt-manager # obvious reasons + pkgs.cachix # arc caching + ]; + + # arc caching + nix = { + binaryCaches = [ "https://arc.cachix.org" ]; + binaryCachePublicKeys = + [ "arc.cachix.org-1:DZmhclLkB6UO0rc0rBzNpwFbbaeLfyn+fYccuAy7YVY=" ]; + }; + + # audio for vm on startup + systemd.user.services.scream-arc = { + enable = true; + description = "Scream Arc"; + serviceConfig = { + ExecStart = + "${pkgs.nur.repos.arc.packages.scream-arc}/bin/scream -i virbr0 -o pulse -v"; + Restart = "always"; + }; + wantedBy = [ "multi-user.target" ]; + requires = [ "pulseaudio.service" ]; + }; + networking.hostName = "samhain"; networking.hostId = "617050fc"; services.xserver.deviceSection = lib.mkDefault '' Option "TearFree" "true" - ''; + BusID "PCI:37:0:0" + ''; # busId must be decimal conversion of the equivalent but matching the format, this was 0000:25:00.0 + + services.xserver.wacom.enable = true; networking.useDHCP = false; networking.interfaces.enp34s0.useDHCP = true; networking.firewall.allowPing = true; - networking.firewall.allowedTCPPorts = [ 445 139 9091 ]; - networking.firewall.allowedUDPPorts = [ 137 138 ]; + networking.firewall.allowedTCPPorts = [ 445 139 9091 ]; # smb transmission + networking.firewall.allowedUDPPorts = [ 137 138 4010 ]; # smb scream system.stateVersion = "20.09"; diff --git a/configuration/hosts/samhain/hardware-configuration.nix b/configuration/hosts/samhain/hardware-configuration.nix index c8340a63..476884e5 100644 --- a/configuration/hosts/samhain/hardware-configuration.nix +++ b/configuration/hosts/samhain/hardware-configuration.nix @@ -51,16 +51,6 @@ fsType = "zfs"; }; - fileSystems."/home/kat/Games" = { - device = "zgame/lutris"; - fsType = "zfs"; - }; - - fileSystems."/home/kat/.local/share/Steam" = { - device = "zgame/steam"; - fsType = "zfs"; - }; - swapDevices = [ { device = "/dev/disk/by-uuid/89831a0f-93e6-4d30-85e4-09061259f140"; } { device = "/dev/disk/by-uuid/8f944315-fe1c-4095-90ce-50af03dd5e3f"; } diff --git a/configuration/hosts/samhain/screenstub.yml b/configuration/hosts/samhain/screenstub.yml new file mode 100644 index 00000000..e6eea2d5 --- /dev/null +++ b/configuration/hosts/samhain/screenstub.yml @@ -0,0 +1,89 @@ +screens: +- monitor: # fill in with info from `screenstub detect` + manufacturer: BNQ + model: BenQ GW2270 + #serial: "..." + guest_source: # Could be automatically detected, but best to fill in if monitor has more than two inputs + name: HDMI-1 + #value: 0x0f # can also specify raw VCP value + host_source: # Usually automatically detected + name: HDMI-2 + #value: 0x11 + ddc: + #minimal_delay: 100ms # minimum time to wait between switching inputs again + #guest: [] # disable input switching + #host: [] # disable input switching + guest: # configure how to switch to the guest + #- guest_wait # wait until guest agent responds, otherwise might get stranded on other input + - ddc # (default) Use ddc-rs + #exec: ["ddcutil", "-g", "BNQ", "setvcp", "0x60", "{}"] + #- exec: [ddccontrol, -r, "0x60", -w, "{}", /dev/i2c-5] + host: # configure how to switch back from the guest + - ddc # (default) Controls DDC from the host GPU - requires no guest agent but many monitors won't support this + #- exec: ["ddcutil", "-g", "BNQ", "setvcp", "0x60", "{}"] + #- guest_exec: ["C:/ddcset.exe", "setvcp", "60", "{:x}"] # or "0x{:x}" for hex input value + #- guest_exec: ["C:/ScreenBright.exe", "-set", "0x60", "{}"] # "{}" is for decimal input value + #- exec: ["ssh", "user@vm", "ddcutil", "setvcp", "0x60", "{}"] # system commands can also be used + +qemu: + #routing: qmp # (default) does not require extra configuration or dependencies + #routing: spice # no external requirements # CURRENTLY UNIMPLEMENTED + #routing: input-linux # requires uinput + #routing: virtio-host # requires uinput, recommended for performance, requires vioinput drivers in guest + #driver: ps2 # use PS/2 in the guest for all input devices (absolute mouse mode unsupported) + #driver: usb # use USB keyboard/mouse/tablet in the guest + #driver: virtio # Recommended but vioinput drivers must be installed in guest + #keyboard_driver: ps2 # (default) can also be set separately per input type, this should rarely be necessary + #relative_driver: usb # (default) + #absolute_driver: usb # (default) + #driver: virtio + #relative_driver: virtio + qmp_socket: /tmp/vfio-qmp # path to QMP socket + #ga_socket: /tmp/vfio-qga # path to Guest Agent socket + +key_remap: # Arbitrary keys can be remapped in the guest + # See https://docs.rs/input-linux/*/input_linux/enum.Key.html for a list of key names available (mouse buttons can also be used) + LeftMeta: Reserved # disable the windows key + RightAlt: LeftMeta # remap right alt to trigger the windows key + +hotkeys: # Trigger various events on key combinations +- triggers: [G] + modifiers: [LeftMeta] + on_release: false # trigger on downpress of key + global: false # optionally trigger even when not in focus # CURRENTLY UNIMPLEMENTED + events: # Select which events to trigger with this hotkey + - toggle_grab: xcore # Standard Xorg window grab + #- toggle_grab:y + # xdevice: # CURRENTLY UNIMPLEMENTED + # devices: # Only grab specific devices from Xorg + # - "..." + #- exec: [echo, hi] # Execute an arbitrary system command + #- show_host # switch to the host display + #- show_guest # switch to the guest display + #- toggle_show # switch the current display + #- unstick_guest # causes all held keys to be released in the guest + #- shutdown # safely shuts the guest system down + #- reboot # reboots the guest + #- exit # quits screenstub +- triggers: [Y] + modifiers: [LeftMeta] + events: + - toggle_grab: xcore # Confine input/mouse to window + - toggle_grab: + evdev: # evdev grab is useful for playing games that don't work with absolute mouse events + exclusive: false # grab exclusive access from the device(s) + #new_device_name: "unique-grab-name" # create a new uinput device for this grab + xcore_ignore: [absolute] # which events to ignore from the window (key, button, absolute) + evdev_ignore: [button] # which events to ignore from the evdev device + devices: # List of devices to forward to guest + - /dev/input/by-id/usb-04d9_USB_Laser_Game_Mouse-event-mouse + - unstick_host # force-depress all Xorg keys (prevents keys getting stuck) +- triggers: [T] + modifiers: [LeftMeta] + on_release: false + events: + - toggle_show + +exit_events: # Events to trigger on window close / exit +- show_host +#- shutdown diff --git a/configuration/profiles/common/users.nix b/configuration/profiles/common/users.nix index dc1f838a..3ab903f3 100644 --- a/configuration/profiles/common/users.nix +++ b/configuration/profiles/common/users.nix @@ -15,6 +15,7 @@ isNormalUser = true; openssh.authorizedKeys.keys = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDX2x9eT02eJn2lAc7zA3c84+FXkft1f3hbTXKZ6+q/F kat@yule" + "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCno0Ci2VEkxgWu1mR24puvphHw3KdaNelEhS7n5LEtNuFuNLd0vhQkP5sWGqg4W9pjcHELV8898Bz7+K+ikbZgD2yiK9ROFxSZc/e47H5m9Yn74blrahFmu4S1RL+UPlqnJoUwULsP28xDW3iZbBYnWffMGWXL6Yr8oAdMvOMmKf6KZ/akfRIB22kS6y1XeJnfnzQZRImr+whrNiXKrCXqlcINLkObZW0Wv+BwfXKMhD0lqlTJYAyMdmfWy7ARep032A/XE+gOcln9Ut55GcVwS45LreZuXlk66lHZvFNeK0ETa079Fl7Bx4kYhuek48bIYwpqsIPW+1CDNyeW79Fd dorkd@DESKTOP-U9VEBIL" ]; shell = pkgs.fish; extraGroups = [ "wheel" ]; diff --git a/configuration/profiles/desktop/default.nix b/configuration/profiles/desktop/default.nix index d4b4449e..5065e3d7 100644 --- a/configuration/profiles/desktop/default.nix +++ b/configuration/profiles/desktop/default.nix @@ -15,6 +15,8 @@ in { pkgs._1password pkgs.mpv pkgs.mumble + pkgs.obs-studio + pkgs.avidemux pkgs.vlc nixpkgs-master.syncplay nixpkgs-master.youtube-dl @@ -32,18 +34,14 @@ in { pkgs.appimage-run pkgs.gparted pkgs.scrot - pkgs.gimp + pkgs.gimp-with-plugins pkgs.vscode pkgs.cryptsetup pkgs.neofetch pkgs.htop ]; - programs.fish = { - interactiveShellInit = '' - set PATH $PATH $HOME/.config/composer/vendor/bin - ''; - }; + programs.fish = { interactiveShellInit = "set -g fish_greeting ''"; }; services.kdeconnect = { enable = true; @@ -72,6 +70,7 @@ in { fonts.fontconfig.enable = true; fonts.fonts = [ pkgs.nerdfonts pkgs.corefonts ]; + # KDE Connect networking.firewall = { allowedTCPPortRanges = [{ from = 1714; diff --git a/configuration/profiles/development/default.nix b/configuration/profiles/development/default.nix index 04611b82..107a26da 100644 --- a/configuration/profiles/development/default.nix +++ b/configuration/profiles/development/default.nix @@ -1,6 +1,15 @@ { config, lib, pkgs, ... }: { + virtualisation.libvirtd = { + enable = true; + qemuOvmf = true; + qemuRunAsRoot = false; + onBoot = "ignore"; + onShutdown = "shutdown"; + }; + users.users.kat.extraGroups = [ "libvirtd" ]; + environment.systemPackages = let python-env = python-packages: with pkgs.python38Packages; [ @@ -14,6 +23,12 @@ home-manager.users.kat = { programs.go.enable = true; + programs.fish = { + interactiveShellInit = '' + set fish_user_paths $fish_user_paths $HOME/.config/composer/vendor/bin + ''; + }; + home.packages = [ pkgs.jetbrains.clion pkgs.jetbrains.idea-ultimate diff --git a/configuration/profiles/gaming/default.nix b/configuration/profiles/gaming/default.nix index 30ea3050..435f3ec7 100644 --- a/configuration/profiles/gaming/default.nix +++ b/configuration/profiles/gaming/default.nix @@ -3,8 +3,5 @@ hardware.opengl.extraPackages32 = with pkgs.pkgsi686Linux; [ libva ]; hardware.pulseaudio.support32Bit = true; - home-manager.users.kat = { - home.packages = - [ pkgs.lutris pkgs.steam pkgs.steam-run pkgs.multimc pkgs.obs-studio ]; - }; + home-manager.users.kat = { home.packages = [ pkgs.lutris pkgs.steam-run ]; }; } diff --git a/configuration/profiles/xfce/default.nix b/configuration/profiles/xfce/default.nix index 0fb345aa..78e9a56d 100644 --- a/configuration/profiles/xfce/default.nix +++ b/configuration/profiles/xfce/default.nix @@ -13,6 +13,7 @@ pkgs.xfce.orage pkgs.xfce.xfce4-battery-plugin pkgs.xfce.xfce4-sensors-plugin + pkgs.xfce.xfce4-weather-plugin pkgs.xfce.xfce4-pulseaudio-plugin pkgs.xfce.xfce4-whiskermenu-plugin pkgs.xfce.xfce4-genmon-plugin