From 132b48dfb3723191d2aecc1c3bb50b6e59325d49 Mon Sep 17 00:00:00 2001 From: iFargle Date: Wed, 5 Jul 2023 21:58:58 +0900 Subject: [PATCH] Add OpenGL support --- configuration.nix | 26 +----------------- desktops/common.nix | 40 ++++++++++++++++++++++++++++ flake.nix | 2 +- hosts/nixos-laptop/configuration.nix | 16 ++++++----- modules/xserver.nix | 15 ----------- 5 files changed, 51 insertions(+), 48 deletions(-) create mode 100644 desktops/common.nix delete mode 100644 modules/xserver.nix diff --git a/configuration.nix b/configuration.nix index 41e561ce..25c58a0e 100644 --- a/configuration.nix +++ b/configuration.nix @@ -1,19 +1,14 @@ -# Edit this configuration file to define what should be installed on -# your system. Help is available in the configuration.nix(5) man page -# and in the NixOS manual (accessible by running ‘nixos-help’). - # Nix Reference Manual: # https://nixos.org/manual/nix/stable/ # NixOS Packages / Options: # https://search.nixos.org/packages? -# Other things to consider: -# Telegraf { lib, config, pkgs, ... }: { imports = [ # Desktop Environments + ./desktops/common.nix ./desktops/gnome.nix # Software @@ -91,30 +86,11 @@ LC_TIME = "en_US.UTF-8"; }; - # Enable sound with pipewire. - sound.enable = true; - hardware.pulseaudio.enable = false; - security.rtkit.enable = true; - services.pipewire = { - enable = true; - alsa.enable = true; - alsa.support32Bit = true; - pulse.enable = true; - }; - # Define a user account. Don't forget to set a password with ‘passwd’. users.users.albert = { isNormalUser = true; description = "Albert J. Copeland"; extraGroups = [ "networkmanager" "wheel" ]; - packages = with pkgs; [ - firefox - bitwarden - steam - lutris - vlc - vscodium - ]; }; # Allow unfree packages diff --git a/desktops/common.nix b/desktops/common.nix new file mode 100644 index 00000000..220f6f55 --- /dev/null +++ b/desktops/common.nix @@ -0,0 +1,40 @@ +# If a GUI is enabled, install GUI apps: +{ lib, pkgs, config, ... }: { + users.users.albert = { + packages = with pkgs; [ + firefox + bitwarden + steam + lutris + vlc + vscodium + ]; + }; + + # Enable sound with pipewire. + sound.enable = true; + hardware.pulseaudio.enable = false; + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + }; + + # Configure keymap in X11 + services.xserver = { + enable = true; + layout = "us"; + xkbVariant = ""; + libinput = { + enable = true; + touchpad.tapping = true; + }; + + # Enable nVidia drivers + videoDrivers = [ "nvidia" ]; + autorun = true; + }; + +} \ No newline at end of file diff --git a/flake.nix b/flake.nix index 6ddc0a4e..b81a47df 100644 --- a/flake.nix +++ b/flake.nix @@ -54,7 +54,7 @@ modules = [ # Configuration Imports ./hosts/${hostname}/hardware-configuration.nix # Hardware Configuration - ./hosts/${hostname}/configuration.nix # Extra options for the host hardware configuration + ./hosts/${hostname}/configuration.nix # Extra options for the host configuration ./configuration.nix # Common NixOS Configuration # Flake Imports diff --git a/hosts/nixos-laptop/configuration.nix b/hosts/nixos-laptop/configuration.nix index 5fd3b971..82f42523 100644 --- a/hosts/nixos-laptop/configuration.nix +++ b/hosts/nixos-laptop/configuration.nix @@ -22,13 +22,16 @@ tod.driver = pkgs.libfprint-2-tod1-vfs0090; }; - # Enable nVidia PRIME Render Offload + # Enable nVidia PRIME Render Offload and OpenGL # https://github.com/NixOS/nixos-hardware/blob/master/lenovo/thinkpad/p1/3th-gen/nvidia.nix - hardware.nvidia.prime = { - # Bus ID of the Intel GPU. - intelBusId = lib.mkDefault "PCI:0:2:0"; - # Bus ID of the NVIDIA GPU. - nvidiaBusId = lib.mkDefault "PCI:1:0:0"; + hardware = { + opengl.enable = true; + opengl.driSupport32Bit = true; + + nvidia.prime = { + intelBusId = lib.mkDefault "PCI:0:2:0"; + nvidiaBusId = lib.mkDefault "PCI:1:0:0"; + }; }; # Fingerprint software @@ -36,7 +39,6 @@ imports = [ # Modules - ../../modules/xserver.nix ../../modules/powertop.nix ]; } \ No newline at end of file diff --git a/modules/xserver.nix b/modules/xserver.nix deleted file mode 100644 index 46d0159c..00000000 --- a/modules/xserver.nix +++ /dev/null @@ -1,15 +0,0 @@ -{ lib, config, pkgs, ... }: { - # Configure keymap in X11 - services.xserver = { - enable = true; - layout = "us"; - xkbVariant = ""; - libinput = { - enable = true; - touchpad.tapping = true; - }; - # Enable nVidia drivers - videoDrivers = [ "nvidia" ]; - autorun = true; - }; -} \ No newline at end of file