From 6327a865b35168374a1ae1b569124371862c020b Mon Sep 17 00:00:00 2001 From: Remy Moll <me@moll.re> Date: Mon, 2 Sep 2024 11:13:38 +0200 Subject: [PATCH] fixes and nvidia --- hosts/spectre-x360-2018/configuration.nix | 1 + hosts/spectre-x360-2018/default.nix | 2 +- .../gnome-shell-customization.nix | 11 ++++ modules/home-manager/keepassxc.nix | 7 ++ modules/home-manager/obsidian.nix | 1 - modules/nixos/nvidia.nix | 64 +++++++++++++++++++ users/remy.nix | 7 +- 7 files changed, 89 insertions(+), 4 deletions(-) create mode 100644 modules/home-manager/keepassxc.nix create mode 100644 modules/nixos/nvidia.nix diff --git a/hosts/spectre-x360-2018/configuration.nix b/hosts/spectre-x360-2018/configuration.nix index 9f40cc6..b619314 100644 --- a/hosts/spectre-x360-2018/configuration.nix +++ b/hosts/spectre-x360-2018/configuration.nix @@ -30,6 +30,7 @@ # Select internationalisation properties. i18n.defaultLocale = "en_US.UTF-8"; + # i18n.supportedLocales = [ "en_US.UTF-8" "de_DE.UTF-8" ]; diff --git a/hosts/spectre-x360-2018/default.nix b/hosts/spectre-x360-2018/default.nix index 5be14ab..5b9615f 100644 --- a/hosts/spectre-x360-2018/default.nix +++ b/hosts/spectre-x360-2018/default.nix @@ -6,10 +6,10 @@ ./hardware-configuration.nix ../../modules/nixos/flatpak.nix ../../modules/nixos/gdm.nix + ../../modules/nixos/nvidia.nix ../../modules/nixos/pipewire.nix ../../modules/nixos/podman.nix ../../utils/binary-cache.nix ../../utils/garbage-collection.nix - ]; } diff --git a/modules/home-manager/gnome-shell-customization.nix b/modules/home-manager/gnome-shell-customization.nix index b16d0ce..7a256a6 100644 --- a/modules/home-manager/gnome-shell-customization.nix +++ b/modules/home-manager/gnome-shell-customization.nix @@ -72,5 +72,16 @@ with lib.hm.gvariant; show-windows-preview = true; }; + dconf.settings."org/gnome/mutter" = { + dynamic-workspaces = true; + edge-tiling = false; + workspaces-only-on-primary = true; + }; + + + dconf.settings."org/gnome/desktop/interface" = { + color-scheme = "prefer-dark"; + show-battery-percentage = true; + }; } \ No newline at end of file diff --git a/modules/home-manager/keepassxc.nix b/modules/home-manager/keepassxc.nix new file mode 100644 index 0000000..5a0edcf --- /dev/null +++ b/modules/home-manager/keepassxc.nix @@ -0,0 +1,7 @@ +{pkgs, ...}: +{ + home.packages = [ + pkgs.keepassxc + ]; + +} diff --git a/modules/home-manager/obsidian.nix b/modules/home-manager/obsidian.nix index 7cdc1cf..1979463 100644 --- a/modules/home-manager/obsidian.nix +++ b/modules/home-manager/obsidian.nix @@ -3,6 +3,5 @@ home.packages = [ pkgs.obsidian ]; - # obsidian options } diff --git a/modules/nixos/nvidia.nix b/modules/nixos/nvidia.nix new file mode 100644 index 0000000..3b5f214 --- /dev/null +++ b/modules/nixos/nvidia.nix @@ -0,0 +1,64 @@ +{ + config, + lib, + pkgs, + ... +}: +{ + + # Enable OpenGL + hardware.opengl = { + enable = true; + }; + + # Load nvidia driver for Xorg and Wayland + services.xserver.videoDrivers = ["nvidia"]; + + hardware.nvidia = { + # manually specify the driver version + package = config.boot.kernelPackages.nvidiaPackages.mkDriver { + version = "555.58.02"; + sha256_64bit = "sha256-xctt4TPRlOJ6r5S54h5W6PT6/3Zy2R4ASNFPu8TSHKM="; + sha256_aarch64 = "sha256-8hyRiGB+m2hL3c9MDA/Pon+Xl6E788MZ50WrrAGUVuY="; + openSha256 = "sha256-8hyRiGB+m2hL3c9MDA/Pon+Xl6E788MZ50WrrAGUVuY="; + settingsSha256 = "sha256-ZpuVZybW6CFN/gz9rx+UJvQ715FZnAOYfHn5jt5Z2C8="; + persistencedSha256 = "sha256-xctt4TPRlOJ6r5S54h5W6PT6/3Zy2R4ASNFPu8TSHKM="; + }; + + # Modesetting is required. + modesetting.enable = true; + + # Nvidia power management. Experimental, and can cause sleep/suspend to fail. + # Enable this if you have graphical corruption issues or application crashes after waking + # up from sleep. This fixes it by saving the entire VRAM memory to /tmp/ instead + # of just the bare essentials. + powerManagement.enable = false; + + # Fine-grained power management. Turns off GPU when not in use. + # Experimental and only works on modern Nvidia GPUs (Turing or newer). + powerManagement.finegrained = false; + + open = false; + + # Enable the Nvidia settings menu, + # accessible via `nvidia-settings`. + nvidiaSettings = true; + }; + + ## See https://nixos.wiki/wiki/Nvidia + hardware.nvidia.prime = { + intelBusId = "PCI:0:2:0"; + nvidiaBusId = "PCI:1:0:0"; + + ## Reverse PRIME synchronization + reverseSync.enable = true; + # Enable if using an external GPU + allowExternalGpu = false; + + ## Alternatively enable offloading + # offload = { + # enable = true; + # enableOffloadCmd = true; + # }; + }; +} diff --git a/users/remy.nix b/users/remy.nix index b298612..504fe8b 100644 --- a/users/remy.nix +++ b/users/remy.nix @@ -2,13 +2,16 @@ with lib.hm.gvariant; { imports = [ - ../modules/home-manager/fish.nix ../modules/home-manager/browser.nix ../modules/home-manager/code.nix + ../modules/home-manager/fish.nix ../modules/home-manager/flatpaks.nix + ../modules/home-manager/gnome-shell-customization.nix + ../modules/home-manager/keepassxc.nix + ../modules/home-manager/obsidian.nix ../modules/home-manager/thunderbird.nix ../modules/home-manager/quickshare.nix - ../modules/home-manager/gnome-shell-customization.nix + ]; ## Home Manager configuration