From d92b393f01feae04c94a9b1ffd8d8a582132ccfe Mon Sep 17 00:00:00 2001 From: Colin Date: Thu, 7 Sep 2023 10:24:20 +0000 Subject: [PATCH] hardware/x86_64.nix: split these options into more relevant files also makes it so we dont ship opengl on platforms where we dont need it (servo) --- hosts/by-name/moby/default.nix | 2 -- hosts/common/hardware.nix | 1 + hosts/modules/gui/default.nix | 8 ++++++++ hosts/modules/hardware/x86_64.nix | 5 ----- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/hosts/by-name/moby/default.nix b/hosts/by-name/moby/default.nix index ef8ab410..ee79f56d 100644 --- a/hosts/by-name/moby/default.nix +++ b/hosts/by-name/moby/default.nix @@ -136,6 +136,4 @@ # make Pinephone front LEDs writable by user. SUBSYSTEM=="leds", DEVPATH=="*/*:indicator", RUN+="${chmod} g+w /sys%p/brightness", RUN+="${chown} :video /sys%p/brightness" ''; - - hardware.opengl.driSupport = true; } diff --git a/hosts/common/hardware.nix b/hosts/common/hardware.nix index 66a70b1f..2eabd534 100644 --- a/hosts/common/hardware.nix +++ b/hosts/common/hardware.nix @@ -26,6 +26,7 @@ # powertop will default to putting USB devices -- including HID -- to sleep after TWO SECONDS powerManagement.powertop.enable = false; + powerManagement.cpuFreqGovernor = "powersave"; services.logind.extraConfig = '' # don’t shutdown when power button is short-pressed diff --git a/hosts/modules/gui/default.nix b/hosts/modules/gui/default.nix index 9d7b4133..276bca36 100644 --- a/hosts/modules/gui/default.nix +++ b/hosts/modules/gui/default.nix @@ -132,4 +132,12 @@ "/var/lib/colord" # preserve color calibrations (?) "/var/lib/systemd/backlight" # backlight brightness ]; + + hardware.opengl = lib.mkIf config.sane.programs.guiApps.enabled ({ + driSupport = lib.mkDefault true; + } // (lib.optionalAttrs pkgs.stdenv.isx86_64 { + # for 32 bit applications + # upstream nixpkgs forbids setting driSupport32Bit unless specifically x86_64 (so aarch64 isn't allowed) + driSupport32Bit = lib.mkDefault true; + })); } diff --git a/hosts/modules/hardware/x86_64.nix b/hosts/modules/hardware/x86_64.nix index d7bf5f04..d29a91a1 100644 --- a/hosts/modules/hardware/x86_64.nix +++ b/hosts/modules/hardware/x86_64.nix @@ -9,12 +9,7 @@ # efi_pstore evivars ]; - powerManagement.cpuFreqGovernor = "powersave"; hardware.cpu.amd.updateMicrocode = true; # desktop hardware.cpu.intel.updateMicrocode = true; # laptop - - hardware.opengl.driSupport = true; - # For 32 bit applications - hardware.opengl.driSupport32Bit = true; }; }