diff --git a/home/programs/graphical/wms/hyprland/config/keybinds.nix b/home/programs/graphical/wms/hyprland/config/keybinds.nix index cd9fc84..880a730 100644 --- a/home/programs/graphical/wms/hyprland/config/keybinds.nix +++ b/home/programs/graphical/wms/hyprland/config/keybinds.nix @@ -102,15 +102,7 @@ # # Switch workspace (swapping to current monitor) # - "SUPER, 1, exec, hyprland-swap-workspace 1" - "SUPER, 2, exec, hyprland-swap-workspace 2" - "SUPER, 3, exec, hyprland-swap-workspace 3" - "SUPER, 4, exec, hyprland-swap-workspace 4" - "SUPER, 5, exec, hyprland-swap-workspace 5" - "SUPER, 6, exec, hyprland-swap-workspace 6" - "SUPER, 7, exec, hyprland-swap-workspace 7" - "SUPER, 8, exec, hyprland-swap-workspace 8" - "SUPER, 9, exec, hyprland-swap-workspace 9" + # TODO: requires script (swap-workspace) # # Move window to workspace diff --git a/home/programs/graphical/wms/hyprland/default.nix b/home/programs/graphical/wms/hyprland/default.nix index ba062f0..43c1e4d 100644 --- a/home/programs/graphical/wms/hyprland/default.nix +++ b/home/programs/graphical/wms/hyprland/default.nix @@ -6,7 +6,7 @@ }: let inherit (lib) mkIf; - inherit (import ./packages {inherit pkgs;}) hyprland-swap-workspace; + inherit (import ./packages {inherit pkgs;}) dbus-hyprland-env; cfg = osConfig.myOptions.home-manager.wms.hyprland; in { @@ -16,7 +16,7 @@ in { config = mkIf cfg.enable { home.packages = with pkgs; [ - hyprland-swap-workspace + dbus-hyprland-env ]; wayland.windowManager.hyprland = { diff --git a/home/programs/graphical/wms/hyprland/packages/dbus-hyprland-env.nix b/home/programs/graphical/wms/hyprland/packages/dbus-hyprland-env.nix new file mode 100644 index 0000000..8fef3e5 --- /dev/null +++ b/home/programs/graphical/wms/hyprland/packages/dbus-hyprland-env.nix @@ -0,0 +1,11 @@ +{pkgs, ...}: +pkgs.writeTextFile { + name = "dbus-hyprland-env"; + destination = "/bin/dbus-hyprland-environment"; + executable = true; + text = '' + dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=hyprland + systemctl --user stop pipewire pipewire-media-session xdg-desktop-portal xdg-desktop-portal-wlr + systemctl --user start pipewire wireplumber pipewire-media-session xdg-desktop-portal xdg-desktop-portal-hyprland + ''; +} diff --git a/home/programs/graphical/wms/hyprland/packages/default.nix b/home/programs/graphical/wms/hyprland/packages/default.nix index 2679e8c..36e2305 100644 --- a/home/programs/graphical/wms/hyprland/packages/default.nix +++ b/home/programs/graphical/wms/hyprland/packages/default.nix @@ -3,7 +3,7 @@ ... }: let packages = { - hyprland-swap-workspace = pkgs.callPackage ./hyprland-swap-workspace.nix {}; + dbus-hyprland-env = pkgs.callPackage ./dbus-hyprland-env.nix {}; }; in packages diff --git a/home/programs/graphical/wms/hyprland/packages/hyprland-swap-workspace.nix b/home/programs/graphical/wms/hyprland/packages/hyprland-swap-workspace.nix deleted file mode 100644 index 25433db..0000000 --- a/home/programs/graphical/wms/hyprland/packages/hyprland-swap-workspace.nix +++ /dev/null @@ -1,4 +0,0 @@ -{pkgs, ...}: - pkgs.writeShellScriptBin "hyprland-swap-workspace" '' - ${builtins.readFile ./hyprland-swap-workspace.sh} - '' diff --git a/home/programs/graphical/wms/hyprland/packages/hyprland-swap-workspace.sh b/home/programs/graphical/wms/hyprland/packages/hyprland-swap-workspace.sh deleted file mode 100644 index 64030b4..0000000 --- a/home/programs/graphical/wms/hyprland/packages/hyprland-swap-workspace.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash - -WORKSPACE="$1" - -monitors_out="$(hyprctl monitors -j)" -focused_mon="$(echo "$monitors_out" | jq '.[] | select(.focused==true) | .id')" -focused_wks="$(echo "$monitors_out" | jq '.[].activeWorkspace.id')" - -# Workspace is already focused, check on which monitor -if echo "$focused_wks" | grep "$WORKSPACE" >/dev/null; then - mon_id="$(echo "$monitors_out" | jq ".[] | select(.activeWorkspace.id==$WORKSPACE) | .id")" - - # If the workspace is focused on the active monitor, don't do anything (we're here). - # Otherwise, swap the workspaces. - if [ "$mon_id" -ne "$focused_mon" ]; then - hyprctl dispatch swapactiveworkspaces "$focused_mon" "$mon_id" - fi -# Switching to an unfocused workspace, always move it to focused monitor -else - hyprctl dispatch moveworkspacetomonitor "$WORKSPACE" "$focused_mon" - hyprctl dispatch workspace "$WORKSPACE" -fi diff --git a/home/programs/terminal/editors/neovim/default.nix b/home/programs/terminal/editors/neovim/default.nix index 2e58c6b..1a1a168 100644 --- a/home/programs/terminal/editors/neovim/default.nix +++ b/home/programs/terminal/editors/neovim/default.nix @@ -26,8 +26,8 @@ source = pkgs.fetchFromGitHub { owner = "ItsDrike"; repo = "AstroNvimUser"; - rev = "v0.1.2"; - sha256 = "sha256-PPejIy8BGxilcFAvBZQVfVDwTNEm1Tu6e0AlzIZbYXY="; + rev = "v0.1.0"; + sha256 = "sha256-2o25+2CHoDS90kDk5ixiQDE4MHybgvVLL7jr7AHWhqU="; }; recursive = true; }; diff --git a/home/programs/terminal/shell/zsh/rc/profile.zsh b/home/programs/terminal/shell/zsh/rc/profile.zsh index de4a41f..e13ea2b 100644 --- a/home/programs/terminal/shell/zsh/rc/profile.zsh +++ b/home/programs/terminal/shell/zsh/rc/profile.zsh @@ -12,7 +12,7 @@ fi # Start graphical session automatically on tty1 if Hyprland or startx is available if [ "$(tty)" = "/dev/tty1" ] && [ "$UID" != 0 ]; then if command -v Hyprland >/dev/null; then - ! pidof -s Hyprland >/dev/null 2>&1 && Hyprland + ! pidof -s Hyprland >/dev/null 2>&1 && launch-hypr elif command -v startx >/dev/null; then ! pidof -s Xorg >/dev/null 2>&1 && exec startx "$XINITRC" fi diff --git a/hosts/herugrim/default.nix b/hosts/herugrim/default.nix index 6b6beb7..5988f22 100644 --- a/hosts/herugrim/default.nix +++ b/hosts/herugrim/default.nix @@ -58,8 +58,8 @@ type = "laptop"; virtual-machine = false; }; - cpu.type = "amd"; - gpu.type = "hybrid-nvidia"; + cpu.type = "intel"; + gpu.type = "nvidia"; hasTPM = true; }; diff --git a/hosts/herugrim/hardware-configuration.nix b/hosts/herugrim/hardware-configuration.nix index 28065df..c785643 100644 --- a/hosts/herugrim/hardware-configuration.nix +++ b/hosts/herugrim/hardware-configuration.nix @@ -66,11 +66,4 @@ nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; - - # Enable prime-offload - # This machine has AMD igpu + nvidia dgpu, so we need hybrid - hardware.nvidia.prime = { - nvidiaBusId = "PCI:1:0:0"; - amdgpuBusId = "PCI:5:0:0"; - }; } diff --git a/options/device/hardware.nix b/options/device/hardware.nix index 5b03a78..cddde3f 100644 --- a/options/device/hardware.nix +++ b/options/device/hardware.nix @@ -15,21 +15,12 @@ in }; gpu.type = mkOption { - type = with types; nullOr (enum [ "nvidia" "amd" "intel" "hybrid-nvidia" "hybrid-amd" ]); + type = with types; nullOr (enum [ "nvidia" "amd" "intel" ]); default = null; description = '' The manifaturer/type of the primary system GPU. Allows the correct GPU drivers to be loaded, potentially optimizing video output performance. - - If you're on a hybrid system (intel/amd igpu + nvidia/amd dgpu) make sure to use - the hybrid options, only specifying the dgpu will not work properly. - - Note that if using hybrid-nvidia, you will need to set `hardware.nvidia.prime.nvidiaBusId` - and `intelBusId` (or `amdgpuBusId`) to "PCI:x:y:z". To find the correct bus IDs, you can - use `sudo lshw -c display`. Note that you will need to convert the bus ID format from - hexadecimal to decimal, remove the padding (leading zeroes) and replace the dot with a - colon (so for example 0e:00.0 -> PCI:14:0:0). ''; }; diff --git a/system/shared/hardware/gpu/nvidia.nix b/system/shared/hardware/gpu/nvidia.nix index 5679760..fed1519 100644 --- a/system/shared/hardware/gpu/nvidia.nix +++ b/system/shared/hardware/gpu/nvidia.nix @@ -1,36 +1,29 @@ { config, lib, pkgs, ... }: let dev = config.myOptions.device; - isWayland = config.myOptions.home-manager.wms.isWayland; - - inherit (lib) mkIf mkDefault mkMerge; in { - config = mkIf (builtins.elem dev.gpu.type ["nvidia" "hybrid-nvidia"]) { + config = lib.mkIf (dev.gpu.type == "nvidia") { # Nvidia drivers are unfree software nixpkgs.config.allowUnfree = true; # Enable nvidia driver for Xorg and Wayland services.xserver.videoDrivers = ["nvidia"]; - # blacklist nouveau module so that it does not conflict with nvidia drm stuff - # also the nouveau performance is horrible in comparison. - boot.blacklistedKernelModules = ["nouveau"]; - hardware = { nvidia = { # modeestting is required - modesetting.enable = mkDefault true; + modesetting.enable = lib.mkDefault true; # Nvidia power managerment. Experimental, and can cause sleep/suspend to fail. # Enable this if you have graphical corruption issues or application crashes after waking # up from sleep. This fixes it by saving the entire VRAM memory to /tmp/ instead of just # the bare essentials - powerManagement.enable = mkDefault true; + powerManagement.enable = lib.mkDefault true; # Fine-grained power management. Turns off GPU when not in use. # Experimental and only works on modern Nvidia GPUs (Turing or newer) - powerManagement.finegrained = mkDefault false; + powerManagement.finegrained = lib.mkDefault false; # Use the NVidia open source kernel module (not to be confused with the # independent third-party "nouveau" open source driver). @@ -39,27 +32,14 @@ in # # Enable this by default, hosts may override this option if their gpu is not # supported by the open source drivers - open = mkDefault true; + open = lib.mkDefault true; # Add the Nvidia settings package, accessible via `nvidia-settings`. # (useless on NixOS) - nvidiaSettings = mkDefault false; + nvidiaSettings = false; # This ensures all GPUs stay awake even during headless mode. nvidiaPersistenced = true; - - # On Hybrid setups, using Nvidia Optimus PRIME is necessary - # - # There are various options/modes prime can work in, this will default to - # using the offload mode, which will default to running everything on igpu - # except apps that run with certain environmental variables set. To simplify - # things, this will also enable the `nvidia-offload` wrapper script/command. - prime.offload = let - isHybrid = dev.gpu.type == "hybrid-nvidia"; - in { - enable = isHybrid; - enableOffloadCmd = isHybrid; - }; }; # Enable OpenGL @@ -72,6 +52,10 @@ in }; }; + # blacklist nouveau module so that it does not conflict with nvidia drm stuff + # also the nouveau performance is horrible in comparison. + boot.blacklistedKernelModules = ["nouveau"]; + environment = { systemPackages = with pkgs; [ mesa @@ -83,24 +67,12 @@ in libva libva-utils - - glxinfo ]; - sessionVariables = mkMerge [ - { LIBVA_DRIVER_NAME = "nvidia"; } - - (mkIf isWayland { - WLR_NO_HARDWARE_CURSORS = "1"; - }) - - # Run the compositor itself with nvidia GPU? - # Currently disabled - (mkIf (isWayland && (dev.gpu == "hybrid-nvidia")) { - #__NV_PRIME_RENDER_OFFLOAD = "1"; - #WLR_DRM_DEVICES = mkDefault "/dev/dri/card1:/dev/dri/card0"; - }) - ]; + sessionVariables = { + LIBVA_DRIVER_NAME = "nvidia"; + WLR_NO_HARDWARE_CURSORS = "1"; + }; }; }; }