diff --git a/hardware/thinkpad-p1-gen3.nix b/hardware/thinkpad-p1-gen3.nix index 74d280d..6e976ac 100644 --- a/hardware/thinkpad-p1-gen3.nix +++ b/hardware/thinkpad-p1-gen3.nix @@ -10,9 +10,8 @@ availableKernelModules = ["xhci_pci" "nvme" "usb_storage" "sd_mod" "rtsx_pci_sdmmc"]; luks.devices."enc".device = "/dev/disk/by-uuid/1f1e51d6-3084-4f4d-9b4b-6caa0352f542"; }; - kernelModules = ["kvm-intel" "acpi_call"]; + kernelModules = ["kvm-intel" "acpi_call" "nvidia"]; extraModulePackages = with config.boot.kernelPackages; [acpi_call]; - blacklistedKernelModules = ["nvidia" "nouveau"]; supportedFilesystems = ["btrfs"]; kernelParams = ["acpi_backlight=native"]; }; @@ -47,7 +46,7 @@ # Enable bluetooth bluetooth.enable = true; - nvidia.modesetting.enable = false; + nvidia.modesetting.enable = true; nvidia.powerManagement.enable = true; nvidia.prime = { offload.enable = false; @@ -73,7 +72,7 @@ }; services.blueman.enable = true; - #services.xserver.videoDrivers = lib.mkForce ["nvidia"]; + services.xserver.videoDrivers = ["nvidia"]; nixpkgs.config.packageOverrides = pkgs: { vaapiIntel = pkgs.vaapiIntel.override {enableHybridCodec = true;}; diff --git a/modules/malte.nix b/modules/malte.nix index 9c45340..45bdb9c 100644 --- a/modules/malte.nix +++ b/modules/malte.nix @@ -21,6 +21,7 @@ in { "wheel" "networkmanager" "video" + "render" "lp" "kvm" "libvirtd" diff --git a/users/malte/home.nix b/users/malte/home.nix index ccece35..cc7049b 100644 --- a/users/malte/home.nix +++ b/users/malte/home.nix @@ -57,6 +57,7 @@ in { ./helix.nix ./mpv.nix ./broot.nix + ./hypr.nix ../modules/restic-backup.nix ../modules/synchronize-calendars.nix ../modules/persway.nix @@ -67,6 +68,7 @@ in { config = { settings.sway.enable = notDeck; + settings.hyprland.enable = notDeck; settings.mail.enable = notDeck; settings.taskwarrior.enable = notDeck; @@ -74,11 +76,6 @@ in { colorsLight = nix-colors.colorSchemes."gruvbox-light-medium"; colorsDark = nix-colors.colorSchemes."gruvbox-dark-medium"; - wayland.windowManager.hyprland = { - enable = true; - xwayland.enable = true; - }; - home = { packages = [ diff --git a/users/malte/hypr.nix b/users/malte/hypr.nix new file mode 100644 index 0000000..cd5d655 --- /dev/null +++ b/users/malte/hypr.nix @@ -0,0 +1,201 @@ +{ + pkgs, + config, + lib, + nixosConfig, + ... +}: let + cfg = config.settings.hyprland; + + hyprpaperConfig = '' + preload = ~/Downloads/wallpaper.jpg + wallpaper = eDP-1,~/Downloads/wallpaper.jpg + ''; + + hyprlandConfig = '' + # See https://wiki.hyprland.org/Configuring/Monitors/ + ${ + if nixosConfig.networking.hostName == "helix-texta" + then "monitor = eDP-1,3840x2160@60,0x0,2" + else "" + } + + $mainMod = SUPER + + $blue = 458588 + $green = 98971a + + exec-once=waybar + exec-once=hyprpaper + + # For all categories, see https://wiki.hyprland.org/Configuring/Variables/ + input { + kb_layout = us + kb_variant = workman + kb_model = + kb_options = + kb_rules = + + follow_mouse = 1 + sensitivity = 0 + + touchpad { + natural_scroll = yes + } + } + + general { + # See https://wiki.hyprland.org/Configuring/Variables/ for more + + gaps_in = 3 + gaps_out = 3 + border_size = 1 + col.active_border = rgba($bluecc) rgba($greencc) 45deg + col.inactive_border = rgba(282828cc) + + layout = dwindle + } + + decoration { + # See https://wiki.hyprland.org/Configuring/Variables/ for more + + rounding = 2 + blur = yes + blur_size = 3 + blur_passes = 1 + blur_new_optimizations = on + + drop_shadow = yes + shadow_range = 4 + shadow_render_power = 3 + col.shadow = rgba(1a1a1aee) + + dim_inactive = true; + dim_strength = 0.1; + } + + animations { + enabled = yes + + bezier = switchWorkspaces, 0.75, 0 , 0.25, 1 + bezier = easeOutBack , 0.34, 1.16, 0.64, 1 + bezier = easeOutExpo , 0.16, 1 , 0.3 , 1 + bezier = easeOutQuint , 0.22, 1 , 0.36, 1 + bezier = easeInOutQuint , 0.83, 0 , 0.17, 1 + + animation = windows , 1, 3, easeOutExpo + animation = windowsOut, 1, 2, default , popin 80% + animation = border , 1, 3, easeOutExpo + animation = fade , 1, 2, default + animation = workspaces, 1, 2, switchWorkspaces, slidevert + } + + dwindle { + # See https://wiki.hyprland.org/Configuring/Dwindle-Layout/ for more + pseudotile = yes # master switch for pseudotiling. Enabling is bound to mainMod + P in the keybinds section below + preserve_split = yes # you probably want this + } + + gestures { + # See https://wiki.hyprland.org/Configuring/Variables/ for more + workspace_swipe = on + workspace_swipe_distance = 100; + } + + # Example windowrule v1 + # windowrule = float, ^(kitty)$ + # Example windowrule v2 + # windowrulev2 = float,class:^(kitty)$,title:^(kitty)$ + # See https://wiki.hyprland.org/Configuring/Window-Rules/ for more + + bind = $mainMod , return, exec , kitty + bind = $mainMod SHIFT, Q , killactive , + bind = $mainMod SHIFT, E , exit , + bind = $mainMod SHIFT, space , togglefloating, + bind = $mainMod , R , exec , wofi --show drun + bind = $mainMod , P , pseudo , # dwindle + bind = $mainMod , E , togglesplit , # dwindle + + # Move focus with mainMod + arrow keys + bind = $mainMod , H, movefocus , l + bind = $mainMod , L, movefocus , r + bind = $mainMod , K, movefocus , u + bind = $mainMod , J, movefocus , d + bind = $mainMod SHIFT, H, movewindow, l + bind = $mainMod SHIFT, L, movewindow, r + bind = $mainMod SHIFT, K, movewindow, u + bind = $mainMod SHIFT, J, movewindow, d + + # Switch workspaces with mainMod + [0-9] + bind = $mainMod, 1, workspace, 1 + bind = $mainMod, 2, workspace, 2 + bind = $mainMod, 3, workspace, 3 + bind = $mainMod, 4, workspace, 4 + bind = $mainMod, 5, workspace, 5 + bind = $mainMod, 6, workspace, 6 + bind = $mainMod, 7, workspace, 7 + bind = $mainMod, 8, workspace, 8 + bind = $mainMod, 9, workspace, 9 + + # Move active window to a workspace with mainMod + SHIFT + [0-9] + bind = $mainMod SHIFT, 1, movetoworkspace, 1 + bind = $mainMod SHIFT, 2, movetoworkspace, 2 + bind = $mainMod SHIFT, 3, movetoworkspace, 3 + bind = $mainMod SHIFT, 4, movetoworkspace, 4 + bind = $mainMod SHIFT, 5, movetoworkspace, 5 + bind = $mainMod SHIFT, 6, movetoworkspace, 6 + bind = $mainMod SHIFT, 7, movetoworkspace, 7 + bind = $mainMod SHIFT, 8, movetoworkspace, 8 + bind = $mainMod SHIFT, 9, movetoworkspace, 9 + + # Scroll through existing workspaces with mainMod + scroll + bind = $mainMod, mouse_down, workspace, e+1 + bind = $mainMod, mouse_up, workspace, e-1 + + # Move/resize windows with mainMod + LMB/RMB and dragging + bindm = $mainMod, mouse:272, movewindow + bindm = $mainMod, mouse:273, resizewindow + ''; +in { + options.settings.hyprland = with lib; { + enable = mkEnableOption "Enable hyperland config"; + }; + + config = lib.mkIf cfg.enable { + home.packages = [ + (pkgs.writeScriptBin "Hyprland-nvidia" '' + #!/bin/sh + + export _JAVA_AWT_WM_NONREPARENTING=1 + export XCURSOR_SIZE=48 + export GDK_SCALE=2 + + export LIBVA_DRIVER_NAME=nvidia + export XDG_SESSION_TYPE=wayland + export GBM_BACKEND=nvidia-drm + export __GLX_VENDOR_LIBRARY_NAME=nvidia + export WLR_NO_HARDWARE_CURSORS=1 + + exec Hyprland + '') + ]; + + wayland.windowManager.hyprland = { + enable = true; + xwayland.enable = true; + }; + + # If running from tty2 start hyprland + xdg.configFile."fish/conf.d/hyprland.fish".text = '' + set TTY2 (tty) + if test -z \"$DISPLAY\"; and test $TTY2 = '/dev/tty2' + systemd-cat -t Hyprland Hyprland-nvidia + end + ''; + + # Configure hyprpaper + xdg.configFile."hypr/hyprpaper.conf".text = hyprpaperConfig; + # Main config + xdg.configFile."hypr/hyprland.conf".text = hyprlandConfig; + }; +}