From 7dde8c496d88eaaa1da3d9aefb5795ab306cf34c Mon Sep 17 00:00:00 2001 From: doloro Date: Mon, 22 Sep 2025 22:09:28 +0000 Subject: [PATCH] some hyprland changes and nvidia drivers --- nix/configuration.nix | 41 ++++++++++++++++++++++++++++++- nix/modules/hyprland/home.nix | 1 + nix/modules/hyprland/settings.nix | 27 +++++++++++--------- 3 files changed, 57 insertions(+), 12 deletions(-) diff --git a/nix/configuration.nix b/nix/configuration.nix index 8b25c24..f49cbba 100644 --- a/nix/configuration.nix +++ b/nix/configuration.nix @@ -26,6 +26,8 @@ # networking.hostName = "nixos"; # Define your hostname. + nixpkgs.config.allowUnfree = true; + # Configure network connections interactively with nmcli or nmtui. networking.networkmanager.enable = true; @@ -61,7 +63,44 @@ programs.hyprland.enable = true; - + # Enable OpenGL + hardware.graphics = { + enable = true; + }; + + # Load nvidia driver for Xorg and Wayland + services.xserver.videoDrivers = ["nvidia"]; + + hardware.nvidia = { + + # Modesetting is required. + modesetting.enable = true; + + # Nvidia power management. 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 = false; + + # Fine-grained power management. Turns off GPU when not in use. + # Experimental and only works on modern Nvidia GPUs (Turing or newer). + powerManagement.finegrained = false; + + # Use the NVidia open source kernel module (not to be confused with the + # independent third-party "nouveau" open source driver). + # Support is limited to the Turing and later architectures. Full list of + # supported GPUs is at: + # https://github.com/NVIDIA/open-gpu-kernel-modules#compatible-gpus + # Only available from driver 515.43.04+ + open = false; + + # Enable the Nvidia settings menu, + # accessible via `nvidia-settings`. + nvidiaSettings = true; + + # Optionally, you may need to select the appropriate driver version for your specific GPU. + package = config.boot.kernelPackages.nvidiaPackages.latest; + }; # Configure keymap in X11 # services.xserver.xkb.layout = "us"; diff --git a/nix/modules/hyprland/home.nix b/nix/modules/hyprland/home.nix index f67c8c6..3754186 100644 --- a/nix/modules/hyprland/home.nix +++ b/nix/modules/hyprland/home.nix @@ -10,6 +10,7 @@ in enable = true; # set the flake package # settings = { }; + systemd.variables = ["--all"]; package = inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.hyprland; portalPackage = inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.xdg-desktop-portal-hyprland; }; diff --git a/nix/modules/hyprland/settings.nix b/nix/modules/hyprland/settings.nix index 77e0341..9f3bef0 100644 --- a/nix/modules/hyprland/settings.nix +++ b/nix/modules/hyprland/settings.nix @@ -1,10 +1,13 @@ -{ inputs, ... }: +{ inputs, pkgs, ... }: { wayland.windowManager.hyprland.settings = { monitor = [ "HDMI-A-1, 1920x1080@60, 0x0, 1" "DP-3, 1920x1080@144, 1920x0, 1" ]; + exec-once = [ + "hyprctl dispatch workspace 2" # shit solution to get quickshell on the right monitor + ]; env = [ "XCURSOR_SIZE,24" "HYPRCURSOR_SIZE,24" @@ -29,11 +32,11 @@ inactive_opacity = 1.0; shadow = { - enable = false; + enabled = false; }; blur = { - enable = false; + enabled = false; }; }; animations = { @@ -83,10 +86,10 @@ sensitivity = -0.5; }; "$mainMod" = "SUPER"; - binds = [ + bind = [ "$mainMod, Q, exec, foot" - "$mainMod, C, killactive," - "$mainMod, M, exit," + "$mainMod, C, killactive" + "$mainMod, M, exit" "$mainMod, E, exec, $fileManager" "$mainMod, V, togglefloating," "$mainMod, R, exec, $menu" @@ -98,15 +101,13 @@ "$mainMod, down, movefocus, d" "$mainMod, S, exec, $screenShot" "$mainMod, F, fullscreen" - ", home, exec, $toggleSpeaker" - ", end, exec, $toggleMic" "$mainMod, mouse_down, workspace, e+1" "$mainMod, mouse_up, workspace, e-1" - "$mainMod, mouse:272, movewindow" - "$mainMod, mouse:273, resizewindow" + ", home, exec, $toggleSpeaker" + ", end, exec, $toggleMic" ", F8, sendshortcut, , F8, class:^(com\.obsproject\.Studio)$" "$mainMod, 0, workspace, 10" - "$mainMod, SHIFT, 0, movetoworkspace, 10" + "$mainMod SHIFT, 0, movetoworkspace, 10" ] ++ ( builtins.concatLists ( builtins.genList(i: let ws = i + 1; in [ @@ -116,6 +117,10 @@ ) 9 ) ); + bindm = [ + "$mainMod, mouse:272, movewindow" + "$mainMod, mouse:273, resizewindow" + ]; workspace = [ "name:2, monitor:DP-3" ];