aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkshay <[email protected]>2023-02-09 05:14:49 +0000
committerAkshay <[email protected]>2023-02-09 05:14:49 +0000
commit01781658b87f573f05e1fa3f48be810656b93d84 (patch)
treea9ceae7aea2bfd665f96ab049b4773e7b455bddf
parentd681bd972bdef874f8aa65a6903390793810a224 (diff)
working config
-rw-r--r--home.nix2
-rw-r--r--hosts/myrtle/configuration.nix47
-rw-r--r--scripts/default.nix3
-rw-r--r--scripts/nvidia-offload.nix12
4 files changed, 45 insertions, 19 deletions
diff --git a/home.nix b/home.nix
index 8f89697..b801b7f 100644
--- a/home.nix
+++ b/home.nix
@@ -115,6 +115,8 @@
115 initExtra = '' 115 initExtra = ''
116 ${pkgs.hsetroot}/bin/hsetroot -solid "${theme.base00}" 116 ${pkgs.hsetroot}/bin/hsetroot -solid "${theme.base00}"
117 xrdb -load $HOME/.Xresources 117 xrdb -load $HOME/.Xresources
118 xrandr --setprovideroutputsource modesetting NVIDIA-0
119 xrandr --auto
118 ''; 120 '';
119 }; 121 };
120 122
diff --git a/hosts/myrtle/configuration.nix b/hosts/myrtle/configuration.nix
index 74f4861..f0bcb81 100644
--- a/hosts/myrtle/configuration.nix
+++ b/hosts/myrtle/configuration.nix
@@ -12,8 +12,8 @@
12 boot.kernelPackages = pkgs.linuxPackages_latest; 12 boot.kernelPackages = pkgs.linuxPackages_latest;
13 boot.blacklistedKernelModules = [ "nouveau" ]; 13 boot.blacklistedKernelModules = [ "nouveau" ];
14 boot.kernelParams = [ 14 boot.kernelParams = [
15 "i915.modeset=0" 15 # "i915.modeset=0"
16 # "intel_pstate=disable" 16 # "intel_pstate=disable"
17 ]; 17 ];
18 18
19 networking = { 19 networking = {
@@ -106,14 +106,14 @@
106 nvidia = { 106 nvidia = {
107 prime = { 107 prime = {
108 offload.enable = true; 108 offload.enable = true;
109 intelBusId = "PCI:00:02:0"; 109 intelBusId = "PCI:0:2:0";
110 nvidiaBusId = "PCI:01:00:0"; 110 nvidiaBusId = "PCI:1:0:0";
111 }; 111 };
112 package = config.boot.kernelPackages.nvidiaPackages.latest; 112 package = config.boot.kernelPackages.nvidiaPackages.latest;
113 powerManagement = { 113 # powerManagement = {
114 enable = true; 114 # enable = true;
115 finegrained = true; 115 # finegrained = true;
116 }; 116 # };
117 }; 117 };
118 }; 118 };
119 119
@@ -126,22 +126,31 @@
126 xserver = { 126 xserver = {
127 enable = true; 127 enable = true;
128 layout = "us"; 128 layout = "us";
129 videoDrivers = [ "nvidia" "intel" ]; 129 videoDrivers = [ "nvidia" ];
130 displayManager.startx.enable = true; 130 displayManager.startx.enable = true;
131 dpi = 192;
132 libinput.enable = true; 131 libinput.enable = true;
133 serverLayoutSection = '' 132 dpi = 192;
134 Screen "Screen-nvidia[0]" 133 screenSection = ''
135 ''; 134 Option "metamodes" "nvidia-auto-select +0+0 {ForceFullCompositionPipeline=On}"
136 config = lib.mkAfter '' 135 Option "AllowIndirectGLXProtocol" "off"
137 Section "Screen" 136 Option "TripleBuffer" "on"
138 Identifier "Screen-nvidia[0]"
139 Device "Device-nvidia[0]"
140 EndSection
141 ''; 137 '';
138 # serverLayoutSection = lib.mkAfter ''
139 # Screen 0 "Screen-nvidia[0]"
140 # '';
141 # config = lib.mkAfter ''
142 # Section "Screen"
143 # Identifier "Screen-nvidia[0]"
144 # Device "Device-nvidia[0]"
145 # EndSection
146 # '';
142 }; 147 };
143 148
144 openssh.enable = true; 149 openssh = {
150 enable = true;
151 forwardX11 = true;
152 allowSFTP = true;
153 };
145 154
146 asusd = { 155 asusd = {
147 enable = true; 156 enable = true;
diff --git a/scripts/default.nix b/scripts/default.nix
index 220d76d..f134556 100644
--- a/scripts/default.nix
+++ b/scripts/default.nix
@@ -36,6 +36,9 @@ let
36 # battery script 36 # battery script
37 battery = import ./battery.nix pkgs; 37 battery = import ./battery.nix pkgs;
38 38
39 # run-on-gpu script
40 battery = import ./nvidia-offload.nix pkgs;
41
39 # fzf script to switch between tmux sessions 42 # fzf script to switch between tmux sessions
40 tmux-fzf = pkgs.writeScriptBin "tmux-fzf" '' 43 tmux-fzf = pkgs.writeScriptBin "tmux-fzf" ''
41 LIST_DATA="#{session_name}/#{window_name}/#{pane_current_command} @ #{pane_current_path}" 44 LIST_DATA="#{session_name}/#{window_name}/#{pane_current_command} @ #{pane_current_path}"
diff --git a/scripts/nvidia-offload.nix b/scripts/nvidia-offload.nix
new file mode 100644
index 0000000..de55fa2
--- /dev/null
+++ b/scripts/nvidia-offload.nix
@@ -0,0 +1,12 @@
1{ pkgs, ... }:
2
3let
4 name = "nvidia-offload";
5in
6pkgs.writeShellScriptBin name ''
7 export __NV_PRIME_RENDER_OFFLOAD=1
8 export __NV_PRIME_RENDER_OFFLOAD_PROVIDER=NVIDIA-G0
9 export __GLX_VENDOR_LIBRARY_NAME=nvidia
10 export __VK_LAYER_NV_optimus=NVIDIA_only
11 exec "$@"
12''