authorgravatar for 77413091+JulianBarbera@users.noreply.github.comFish <77413091+JulianBarbera@users.noreply.github.com> 2025-08-31 18:49:59-07:00
committergravatar for 77413091+JulianBarbera@users.noreply.github.comFish <77413091+JulianBarbera@users.noreply.github.com> 2025-08-31 18:49:59-07:00
log8b9e928244e5af22945aad2f0a7d961a96f8d18c
tree45329a83e9b7924a6132f0d72106d57edb582e02
parent852b4fdd53e8d4b18f02ccb1f72f66f1c4d4ee07

Switch updates


5 files changed, 10 insertions(+), 104 deletions(-)

flake.nix-1
......@@ -32,7 +32,6 @@
3232 android-nixpkgs = {
3333 url = "github:tadfisher/android-nixpkgs/stable";
3434 inputs.nixpkgs.follows = "nixpkgs";
35
3635 };
3736
3837 nix-options-search.url = "github:madsbv/nix-options-search";
modules/nixos/default.nix+2
......@@ -1,6 +1,7 @@
11{
22 lib,
33 pkgs,
4 host,
45 ...
56}:
67{
......@@ -10,6 +11,7 @@
1011 ./services.nix
1112 ./nvidia.nix
1213 ];
14 config.networking.hostName = host.name;
1315 # make 'shared.darwin' not an error to define.
1416 options.shared.darwin = lib.mkOption {
1517 type = lib.types.anything;
modules/nixos/nvidia.nix-100
......@@ -7,104 +7,4 @@ let
77 nvidiaDriverChannel = config.boot.kernelPackages.nvidiaPackages.latest;
88in
99{
10 services.xserver.videoDrivers = [
11 "nvidia"
12 "amdgpu"
13 ];
14
15 nixpkgs.config = {
16 nvidia.acceptLicense = true;
17 allowUnfree = true;
18 };
19 # Kernel parameters for better Wayland and Hyprland integration
20 boot.kernelParams = [
21 "nvidia-drm.modeset=1" # Enable mode setting for Wayland
22 "nvidia.NVreg_PreserveVideoMemoryAllocations=1" # Improves resume after sleep
23 ];
24
25 # Blacklist nouveau to avoid conflicts
26 boot.blacklistedKernelModules = [ "nouveau" ];
27 environment.variables = {
28 LIBVA_DRIVER_NAME = "nvidia"; # Hardware video acceleration
29 XDG_SESSION_TYPE = "wayland"; # Force Wayland
30 GBM_BACKEND = "nvidia-drm"; # Graphics backend for Wayland
31 __GLX_VENDOR_LIBRARY_NAME = "nvidia"; # Use Nvidia driver for GLX
32 WLR_NO_HARDWARE_CURSORS = "1"; # Fix for cursors on Wayland
33 NIXOS_OZONE_WL = "1"; # Wayland support for Electron apps
34 __GL_GSYNC_ALLOWED = "1"; # Enable G-Sync if available
35 __GL_VRR_ALLOWED = "1"; # Enable VRR (Variable Refresh Rate)
36 WLR_DRM_NO_ATOMIC = "1"; # Fix for some issues with Hyprland
37 NVD_BACKEND = "direct"; # Configuration for new driver
38 MOZ_ENABLE_WAYLAND = "1"; # Wayland support for Firefox
39 };
40
41 hardware = {
42 nvidia = {
43 forceFullCompositionPipeline = true; # Prevents screen tearing
44 # Modesetting is required.
45 modesetting.enable = true;
46
47 powerManagement = {
48 enable = true; # Power management
49 finegrained = true; # More precise power consumption control
50 };
51
52 prime = {
53 offload = {
54 enable = true;
55 enableOffloadCmd = true;
56 };
57
58 nvidiaBusId = "PCI:1:0:0";
59 amdgpuBusId = "PCI:15:0:0";
60
61 };
62
63 # Use the NVidia open source kernel module (not to be confused with the
64 # independent third-party "nouveau" open source driver).
65 # Currently alpha-quality/buggy, so false is currently the recommended setting.
66 open = true;
67
68 # Environment variables for better compatibility
69
70 # Enable the Nvidia settings menu,
71 # accessible via `nvidia-settings`.
72 nvidiaSettings = true;
73
74 package = nvidiaDriverChannel;
75
76 # #Fixes a glitch
77 # nvidiaPersistenced = true;
78 };
79 nvidia-container-toolkit.enable = true;
80
81 graphics = {
82 enable = true;
83 package = nvidiaDriverChannel;
84 enable32Bit = true;
85 extraPackages = with pkgs; [
86 nvidia-vaapi-driver
87 vaapiVdpau
88 libvdpau-va-gl
89 mesa
90 egl-wayland
91 vulkan-loader
92 vulkan-validation-layers
93 libva
94 ];
95 };
96 };
97
98 nix.settings = {
99 substituters = [ "https://cuda-maintainers.cachix.org" ];
100 trusted-public-keys = [
101 "cuda-maintainers.cachix.org-1:0dq3bujKpuEPMCX6U4WylrUDZ9JyUG0VpVZa7CNfq5E="
102 ];
103 };
104
105 environment.systemPackages = with pkgs; [
106 vulkan-tools
107 glxinfo
108 libva-utils # VA-API debugging tools
109 ];
11010}
switch+6-2
......@@ -1,12 +1,16 @@
11#!/bin/sh
22nh_subcommand="os"
33fallback_command="nixos-rebuild"
4hostname=""
5if [ -n "$1" ]; then
6 hostname="#$1"
7fi
48if [ "$(uname -o)" = "darwin" ]; then
59 nh_subcommand="darwin"
6 fallback_command="nix run .#darwin-rebuild"
10 fallback_command="nix run .#darwin-rebuild --"
711fi
812if command -v nh >/dev/null; then
913 nh $nh_subcommand switch .
1014else
11 $fallback_command -- switch --flake .
15 $fallback_command switch --flake '.'"${hostname}"
1216fi
users/natalie/desktop/configuration.nix+2-1
......@@ -163,7 +163,6 @@
163163 };
164164
165165 networking = {
166 hostName = host.name; # Define your hostname.
167166 # wireless.enable = true; # Enables wireless support via wpa_supplicant.
168167 networkmanager.enable = true;
169168 firewall = {
......@@ -180,6 +179,8 @@
180179 };
181180 };
182181
182 services.xserver.videoDrivers = ["nvidia" "amdgpu"]
183
183184 # Open ports in the firewall.
184185 # networking.firewall.allowedUDPPorts = [ ... ];
185186 # Or disable the firewall altogether.