From fd0fcc271249fbfd2bc961e46e1f97e96a9d271f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cyryl=20P=C5=82otnicki?= Date: Sat, 23 May 2020 13:57:07 +0100 Subject: [PATCH] add speed factor --- nixos/boxes/foureighty/configuration.nix | 5 +---- nixos/cli.nix | 1 + nixos/distributed-builds.nix | 2 ++ nixos/gfx-nvidia-optimus.nix | 21 +++++++++++++++++++++ 4 files changed, 25 insertions(+), 4 deletions(-) create mode 100644 nixos/gfx-nvidia-optimus.nix diff --git a/nixos/boxes/foureighty/configuration.nix b/nixos/boxes/foureighty/configuration.nix index fcfbf940..f7d39cdf 100644 --- a/nixos/boxes/foureighty/configuration.nix +++ b/nixos/boxes/foureighty/configuration.nix @@ -30,15 +30,12 @@ package = pkgs.fprintd-thinkpad; }; - hardware.nvidiaOptimus.disable = true; - hardware.nvidia.prime.sync.enable = false; - hardware.bumblebee.enable = false; - imports = [ /etc/nixos/hardware-configuration.nix ../../boot.nix ../../common.nix ../../gfx-intel.nix + ../../gfx-nvidia-optimus.nix ../../zerotier.nix ../../distributed-builds.nix ../../virtualbox.nix diff --git a/nixos/cli.nix b/nixos/cli.nix index 56f3a228..02e2309f 100644 --- a/nixos/cli.nix +++ b/nixos/cli.nix @@ -1,6 +1,7 @@ { config, pkgs, ... }: { home.packages = with pkgs; [ + genpass gdb lldb wget git gnupg curl tmux htop atop pciutils powertop ripgrep-all fd dnsutils du-dust ( pass.withExtensions (ext: [ ext.pass-otp ext.pass-import ext.pass-genphrase ext.pass-audit ext.pass-update ])) diff --git a/nixos/distributed-builds.nix b/nixos/distributed-builds.nix index 0badb822..5ca6360d 100644 --- a/nixos/distributed-builds.nix +++ b/nixos/distributed-builds.nix @@ -11,6 +11,7 @@ sshKey = "/home/cyryl/.ssh/id_ed25519"; system = "x86_64-linux"; maxJobs = 2; + speedFactor = 2; supportedFeatures = [ "kvm" ]; mandatoryFeatures = [ ]; } @@ -20,6 +21,7 @@ sshKey = "/home/cyryl/.ssh/id_ed25519"; system = "x86_64-linux"; maxJobs = 2; + speedFactor = 1; supportedFeatures = [ ]; mandatoryFeatures = [ ]; } diff --git a/nixos/gfx-nvidia-optimus.nix b/nixos/gfx-nvidia-optimus.nix new file mode 100644 index 00000000..49a2b4ec --- /dev/null +++ b/nixos/gfx-nvidia-optimus.nix @@ -0,0 +1,21 @@ +{ config, pkgs, ... }: +let + nvidia-offload = pkgs.writeShellScriptBin "nvidia-offload" '' + export __NV_PRIME_RENDER_OFFLOAD=1 + export __NV_PRIME_RENDER_OFFLOAD_PROVIDER=NVIDIA-G0 + export __GLX_VENDOR_LIBRARY_NAME=nvidia + export __VK_LAYER_NV_optimus=NVIDIA_only + exec -a "$0" "$@" + ''; +in + { + environment.systemPackages = [ nvidia-offload ]; + + services.xserver.videoDrivers = [ "nvidia" ]; + hardware.nvidia.prime.offload.enable = true; + hardware.nvidia.prime = { + intelBusId = "PCI:0:2:0"; + nvidiaBusId = "PCI:1:0:0"; + }; + } +