| author | |
| committer | |
| log | 8b9e928244e5af22945aad2f0a7d961a96f8d18c |
| tree | 45329a83e9b7924a6132f0d72106d57edb582e02 |
| parent | 852b4fdd53e8d4b18f02ccb1f72f66f1c4d4ee07 |
5 files changed, 10 insertions(+), 104 deletions(-)
flake.nix-1| ... | @@ -32,7 +32,6 @@ | ... | @@ -32,7 +32,6 @@ |
| 32 | android-nixpkgs = { | 32 | android-nixpkgs = { |
| 33 | url = "github:tadfisher/android-nixpkgs/stable"; | 33 | url = "github:tadfisher/android-nixpkgs/stable"; |
| 34 | inputs.nixpkgs.follows = "nixpkgs"; | 34 | inputs.nixpkgs.follows = "nixpkgs"; |
| 35 | |||
| 36 | }; | 35 | }; |
| 37 | 36 | ||
| 38 | nix-options-search.url = "github:madsbv/nix-options-search"; | 37 | nix-options-search.url = "github:madsbv/nix-options-search"; |
modules/nixos/default.nix+2| ... | @@ -1,6 +1,7 @@ | ... | @@ -1,6 +1,7 @@ |
| 1 | { | 1 | { |
| 2 | lib, | 2 | lib, |
| 3 | pkgs, | 3 | pkgs, |
| 4 | host, | ||
| 4 | ... | 5 | ... |
| 5 | }: | 6 | }: |
| 6 | { | 7 | { |
| ... | @@ -10,6 +11,7 @@ | ... | @@ -10,6 +11,7 @@ |
| 10 | ./services.nix | 11 | ./services.nix |
| 11 | ./nvidia.nix | 12 | ./nvidia.nix |
| 12 | ]; | 13 | ]; |
| 14 | config.networking.hostName = host.name; | ||
| 13 | # make 'shared.darwin' not an error to define. | 15 | # make 'shared.darwin' not an error to define. |
| 14 | options.shared.darwin = lib.mkOption { | 16 | options.shared.darwin = lib.mkOption { |
| 15 | type = lib.types.anything; | 17 | type = lib.types.anything; |
modules/nixos/nvidia.nix-100| ... | @@ -7,104 +7,4 @@ let | ... | @@ -7,104 +7,4 @@ let |
| 7 | nvidiaDriverChannel = config.boot.kernelPackages.nvidiaPackages.latest; | 7 | nvidiaDriverChannel = config.boot.kernelPackages.nvidiaPackages.latest; |
| 8 | in | 8 | in |
| 9 | { | 9 | { |
| 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 | ]; | ||
| 110 | } | 10 | } |
switch+6-2| ... | @@ -1,12 +1,16 @@ | ... | @@ -1,12 +1,16 @@ |
| 1 | #!/bin/sh | 1 | #!/bin/sh |
| 2 | nh_subcommand="os" | 2 | nh_subcommand="os" |
| 3 | fallback_command="nixos-rebuild" | 3 | fallback_command="nixos-rebuild" |
| 4 | hostname="" | ||
| 5 | if [ -n "$1" ]; then | ||
| 6 | 	hostname="#$1" | ||
| 7 | fi | ||
| 4 | if [ "$(uname -o)" = "darwin" ]; then | 8 | if [ "$(uname -o)" = "darwin" ]; then |
| 5 | nh_subcommand="darwin" | 9 | nh_subcommand="darwin" |
| 6 | fallback_command="nix run .#darwin-rebuild" | 10 | fallback_command="nix run .#darwin-rebuild --" |
| 7 | fi | 11 | fi |
| 8 | if command -v nh >/dev/null; then | 12 | if command -v nh >/dev/null; then |
| 9 | nh $nh_subcommand switch . | 13 | nh $nh_subcommand switch . |
| 10 | else | 14 | else |
| 11 | $fallback_command -- switch --flake . | 15 | $fallback_command switch --flake '.'"${hostname}" |
| 12 | fi | 16 | fi |
users/natalie/desktop/configuration.nix+2-1| ... | @@ -163,7 +163,6 @@ | ... | @@ -163,7 +163,6 @@ |
| 163 | }; | 163 | }; |
| 164 | 164 | ||
| 165 | networking = { | 165 | networking = { |
| 166 | hostName = host.name; # Define your hostname. | ||
| 167 | # wireless.enable = true; # Enables wireless support via wpa_supplicant. | 166 | # wireless.enable = true; # Enables wireless support via wpa_supplicant. |
| 168 | networkmanager.enable = true; | 167 | networkmanager.enable = true; |
| 169 | firewall = { | 168 | firewall = { |
| ... | @@ -180,6 +179,8 @@ | ... | @@ -180,6 +179,8 @@ |
| 180 | }; | 179 | }; |
| 181 | }; | 180 | }; |
| 182 | 181 | ||
| 182 | services.xserver.videoDrivers = ["nvidia" "amdgpu"] | ||
| 183 | |||
| 183 | # Open ports in the firewall. | 184 | # Open ports in the firewall. |
| 184 | # networking.firewall.allowedUDPPorts = [ ... ]; | 185 | # networking.firewall.allowedUDPPorts = [ ... ]; |
| 185 | # Or disable the firewall altogether. | 186 | # Or disable the firewall altogether. |