From 7f6cd33011fa1e9dea323d04e510907b60abdb2d Mon Sep 17 00:00:00 2001 From: Miguel Palhas Date: Sun, 29 Jun 2025 16:24:31 +0100 Subject: [PATCH] wip --- hosts/common/features/display/default.nix | 8 +++ hosts/common/features/display/gdm.nix | 12 +++++ hosts/common/features/display/wayland.nix | 28 ++++++++++ hosts/common/features/display/x11.nix | 56 ++++++++++++++++++++ hosts/common/features/gpu/intel-graphics.nix | 12 +++++ hosts/common/features/gpu/nvidia.nix | 17 ++++++ 6 files changed, 133 insertions(+) create mode 100644 hosts/common/features/display/default.nix create mode 100644 hosts/common/features/display/gdm.nix create mode 100644 hosts/common/features/display/wayland.nix create mode 100644 hosts/common/features/display/x11.nix create mode 100644 hosts/common/features/gpu/intel-graphics.nix create mode 100644 hosts/common/features/gpu/nvidia.nix diff --git a/hosts/common/features/display/default.nix b/hosts/common/features/display/default.nix new file mode 100644 index 0000000..7eb2089 --- /dev/null +++ b/hosts/common/features/display/default.nix @@ -0,0 +1,8 @@ +{ inputs, pkgs, ... }: +{ + imports = [ + ./wayland.nix + ./x11.nix + ./gdm.nix + ]; +} diff --git a/hosts/common/features/display/gdm.nix b/hosts/common/features/display/gdm.nix new file mode 100644 index 0000000..598f618 --- /dev/null +++ b/hosts/common/features/display/gdm.nix @@ -0,0 +1,12 @@ +{ inputs, pkgs, ... }: +{ + services.xserver = { + enable = true; + displayManager = { + startx.enable = true; + gdm.enable = true; + }; + autoRepeatDelay = 250; + autoRepeatInterval = 30; + }; +} diff --git a/hosts/common/features/display/wayland.nix b/hosts/common/features/display/wayland.nix new file mode 100644 index 0000000..1622215 --- /dev/null +++ b/hosts/common/features/display/wayland.nix @@ -0,0 +1,28 @@ +{ inputs, pkgs, ... }: +{ + environment.systemPackages = with pkgs; [ + wl-clipboard + hyprland + ]; + + services.displayManager.sessionPackages = with pkgs; [ + hyprland + ]; + + # thumbnail support for images + services.tumbler.enable = true; + + environment.etc."xdg/wayland-sessions/hyprland.desktop".text = '' + [Desktop Entry] + Name=Hyprland + Comment=Hyprland Wayland Compositor + Exec=Hyprland + Type=Application + DesktopNames=Hyprland + ''; + + nix.settings = { + substituters = [ "https://hyprland.cachix.org" ]; + trusted-public-keys = [ "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=" ]; + }; +} diff --git a/hosts/common/features/display/x11.nix b/hosts/common/features/display/x11.nix new file mode 100644 index 0000000..199ce79 --- /dev/null +++ b/hosts/common/features/display/x11.nix @@ -0,0 +1,56 @@ +{ inputs, pkgs, ... }: +{ + + services = { + desktopManager = { + gnome.enable = true; + }; + xserver.windowManager = { + i3 = { + enable = true; + extraPackages = with pkgs; [ + dmenu + i3status + ]; + }; + }; + sysprof.enable = true; + gnome = { + evolution-data-server.enable = true; + glib-networking.enable = true; + gnome-keyring.enable = true; + gnome-online-accounts.enable = true; + }; + }; + + programs = { + i3lock.enable = true; + dconf.enable = true; + }; + + environment.gnome.excludePackages = + (with pkgs; [ + gnome-photos + gnome-tour + gnome-console + gnome-text-editor + gedit + ]) + ++ (with pkgs; [ + cheese # webcam tool + gnome-music + gnome-terminal + epiphany # web browser + geary # email reader + evince # document viewer + totem # video player + tali # poker game + iagno # go game + hitori # sudoku game + atomix # puzzle game + gnome-contacts + gnome-initial-setup + gnome-shell-extensions + ]); + +} diff --git a/hosts/common/features/gpu/intel-graphics.nix b/hosts/common/features/gpu/intel-graphics.nix new file mode 100644 index 0000000..130364d --- /dev/null +++ b/hosts/common/features/gpu/intel-graphics.nix @@ -0,0 +1,12 @@ +{ config, pkgs, ... }: +{ + services.xserver.videoDrivers = [ "intel" ]; + hardware.graphics = { + enable = true; + extraPackages = with pkgs; [ + vpl-gpu-rt # or intel-media-sdk for QSV + ]; + }; + + programs.xwayland.enable = true; +} diff --git a/hosts/common/features/gpu/nvidia.nix b/hosts/common/features/gpu/nvidia.nix new file mode 100644 index 0000000..e6c7f44 --- /dev/null +++ b/hosts/common/features/gpu/nvidia.nix @@ -0,0 +1,17 @@ +{ config, pkgs, ... }: +{ + hardware.graphics.enable = true; + services.xserver.videoDrivers = [ "nvidia" ]; + hardware.nvidia = { + modesetting.enable = true; + open = false; + nvidiaSettings = true; + package = config.boot.kernelPackages.nvidiaPackages.stable; + }; + + programs.xwayland.enable = true; + + environment.variables = { + "WEBKIT_DISABLE_DMABUF_RENDERER" = "1"; + }; +}