Add OpenGL support

This commit is contained in:
iFargle 2023-07-05 21:58:58 +09:00
parent 79571cd59f
commit 132b48dfb3
5 changed files with 51 additions and 48 deletions

View file

@ -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: # Nix Reference Manual:
# https://nixos.org/manual/nix/stable/ # https://nixos.org/manual/nix/stable/
# NixOS Packages / Options: # NixOS Packages / Options:
# https://search.nixos.org/packages? # https://search.nixos.org/packages?
# Other things to consider:
# Telegraf
{ lib, config, pkgs, ... }: { { lib, config, pkgs, ... }: {
imports = imports =
[ [
# Desktop Environments # Desktop Environments
./desktops/common.nix
./desktops/gnome.nix ./desktops/gnome.nix
# Software # Software
@ -91,30 +86,11 @@
LC_TIME = "en_US.UTF-8"; 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. # Define a user account. Don't forget to set a password with passwd.
users.users.albert = { users.users.albert = {
isNormalUser = true; isNormalUser = true;
description = "Albert J. Copeland"; description = "Albert J. Copeland";
extraGroups = [ "networkmanager" "wheel" ]; extraGroups = [ "networkmanager" "wheel" ];
packages = with pkgs; [
firefox
bitwarden
steam
lutris
vlc
vscodium
];
}; };
# Allow unfree packages # Allow unfree packages

40
desktops/common.nix Normal file
View file

@ -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;
};
}

View file

@ -54,7 +54,7 @@
modules = [ modules = [
# Configuration Imports # Configuration Imports
./hosts/${hostname}/hardware-configuration.nix # Hardware Configuration ./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 ./configuration.nix # Common NixOS Configuration
# Flake Imports # Flake Imports

View file

@ -22,21 +22,23 @@
tod.driver = pkgs.libfprint-2-tod1-vfs0090; 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 # https://github.com/NixOS/nixos-hardware/blob/master/lenovo/thinkpad/p1/3th-gen/nvidia.nix
hardware.nvidia.prime = { hardware = {
# Bus ID of the Intel GPU. opengl.enable = true;
opengl.driSupport32Bit = true;
nvidia.prime = {
intelBusId = lib.mkDefault "PCI:0:2:0"; intelBusId = lib.mkDefault "PCI:0:2:0";
# Bus ID of the NVIDIA GPU.
nvidiaBusId = lib.mkDefault "PCI:1:0:0"; nvidiaBusId = lib.mkDefault "PCI:1:0:0";
}; };
};
# Fingerprint software # Fingerprint software
environment.systemPackages = with pkgs; [ fprintd ]; environment.systemPackages = with pkgs; [ fprintd ];
imports = [ imports = [
# Modules # Modules
../../modules/xserver.nix
../../modules/powertop.nix ../../modules/powertop.nix
]; ];
} }

View file

@ -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;
};
}