laptop mode

This commit is contained in:
Reid 2024-05-22 23:33:30 -07:00
parent 45741e6110
commit f2ee496f47
3 changed files with 68 additions and 30 deletions

View file

@ -3,8 +3,13 @@
{
imports =
[
inputs.hardware.nixosModules.common-cpu-intel-cpu-only
inputs.hardware.nixosModules.common-gpu-nvidia-nonprime
inputs.hardware.nixosModules.common-cpu-intel
inputs.hardware.nixosModules.common-pc-laptop-ssd
inputs.hardware.nixosModules.common-pc-laptop
# this will override your kernel!!!
# use this on macs with t2 chips to get screen, keyboard, trackpad,
# camera, touchbar, and experimental suspend and audio
inputs.hardware.nixosModules.apple-t2
(modulesPath + "/installer/scan/not-detected.nix")
];
@ -24,58 +29,64 @@
# support power features such as suspend to ram
powerManagement.enable = true;
# tune power saving options on boot
# todo: fix usb mice and keyboards from suspending
#powerManagement.powertop.enable = true;
powerManagement.powertop.enable = true;
# thermald proactively prevents overheating on intel CPUs and works well with other tools
services.thermald.enable = true;
# power-profile-daemon for power management
services.power-profiles-daemon.enable = true;
# manage fans for macbook devices
services.mbpfan.enable = true;
# nvidia driver
services.xserver.videoDrivers = [ "nvidia" ];
# better performance than the actual intel driver
services.xserver.videoDrivers = [ "modesetting" ];
hardware.nvidia = {
package = config.boot.kernelPackages.nvidiaPackages.beta;
modesetting.enable = true;
powerManagement.enable = true;
};
boot.kernelParams = [
# use experimental nvidia supplied framebuffer
"nvidia-drm.fbdev=1"
# needed for our broadcom/brcm 4377b chip to work
hardware.firmware = with pkgs; [
my.apple-firmware
];
# VA-API
hardware.opengl = {
extraPackages = with pkgs; [
nvidia-vaapi-driver
intel-media-driver
intel-vaapi-driver
libvdpau-va-gl
];
extraPackages32 = with pkgs.pkgsi686Linux; [
intel-media-driver
intel-vaapi-driver
libvdpau-va-gl
];
};
environment.variables = {
LIBVA_DRIVER_NAME= "nvidia";
VDPAU_DRIVER = "nvidia";
# TODO: remove this once nvidia gets their shit together
# https://forums.developer.nvidia.com/t/cueglstreamproducerconnect-returns-error-801-on-525-53-driver/233610/20
NVD_BACKEND = "direct";
LIBVA_DRIVER_NAME= "iHD";
VDPAU_DRIVER = "va_gl";
# VA-API on firefox
MOZ_DISABLE_RDD_SANDBOX = "1";
};
boot.kernelParams = [
# enable the i915 sandybridge framebuffer compression (475mw savings)
"i915.i915_enable_fbc=1"
"i915.fastboot=1"
"enable_gvt=1"
];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/08cfbb11-5943-4627-a2fc-fd41ce578027";
{ device = "/dev/disk/by-uuid/0f09afdc-88e4-4764-818b-77828931278f";
fsType = "ext4";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/C321-2746";
{ device = "/dev/disk/by-uuid/5659-4909";
fsType = "vfat";
options = [ "fmask=0022" "dmask=0022" ];
};
swapDevices =
[ { device = "/dev/disk/by-uuid/04eddb76-4925-4192-a472-1c2c7e4ac9f7"; }
[ { device = "/dev/disk/by-uuid/f54a2257-f498-4ca0-82af-58f31705cce7"; }
];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking

View file

@ -104,15 +104,17 @@ in {
input = {
kb_layout = "us";
touchpad = {
disable_while_typing = false;
natural_scroll = true;
};
follow_mouse = 1;
sensitivity = 0; # -1.0 - 1.0, 0 means no modification
};
monitor= [
"DVI-D-1, 1920x1080@60, 0x0, 1"
"DP-2, 1920x1080@60, 1920x0, 1"
];
monitor=",highrr,auto,auto";
exec-once = [ "${lib.getExe pkgs.networkmanagerapplet}" ];

View file

@ -0,0 +1,25 @@
{ lib, stdenvNoCC, fetchFromGitHub }:
stdenvNoCC.mkDerivation {
pname = "apple-firmware";
version = "unstable";
src = fetchFromGitHub {
owner = "AdityaGarg8";
repo = "Apple-Firmware";
rev = "c3ba2bce7b5b7d08a478763c678d71ddded60403";
hash = "sha256-p91pyOYKHnJvaBZ7nxrBqFU63UQhMPWhm2GxabfncY4=";
};
installPhase = ''
mkdir -p "$out/lib/firmware/brcm"
cp -r lib/firmware/brcm/. "$out/lib/firmware/brcm/"
'';
meta = with lib; {
description = "Various apple broadcom drivers, ripped from a runner image";
# homepage = "https://jacobxperez.github.io/atkinson-hyperlegible-pro/";
# license = licenses.ofl;
platforms = platforms.all;
};
}