forked from pub-solar/os
dumpyourvms: use systemd for disabling 2nd gpu,
hibernate when closing the lid, cleanup comments
This commit is contained in:
parent
e9895dd7f7
commit
fe2a196641
|
@ -30,13 +30,18 @@ in {
|
|||
virtualisation.enable = true;
|
||||
};
|
||||
|
||||
# fix backlight for keyboard and brightness, adjust function key binding,
|
||||
# intel_pstate for cpu schedutil, resume offset for swapfile, disable amdgpu driver
|
||||
# Fix backlight for keyboard and brightness, adjust function key binding,
|
||||
# intel_pstate for cpu schedutil
|
||||
# For now, the radeon driver seems to work better than amdgpu with Radeon R9 M370X
|
||||
# Explicitly set amdgpu support in place of radeon
|
||||
# Source: https://github.com/NixOS/nixos-hardware/blob/master/common/gpu/amd/southern-islands/default.nix
|
||||
# Try again after https://lists.freedesktop.org/archives/amd-gfx/2023-March/090096.html lands
|
||||
# Maybe linux kernel 6.3?
|
||||
#boot.kernelParams = ["acpi_backlight=video" "hid_apple.fnmode=2" "intel_pstate=passive" "radeon.si_support=0" "amdgpu.si_support=1"];
|
||||
boot.kernelParams = ["acpi_backlight=video" "hid_apple.fnmode=2" "intel_pstate=passive"];
|
||||
boot.loader.efi.canTouchEfiVariables = true;
|
||||
#boot.resumeDevice = "/dev/mapper/cryptroot";
|
||||
|
||||
# fix for Error switching console mode to 1: unsupported on startup
|
||||
# Fix for Error switching console mode to 1: unsupported on startup
|
||||
boot.loader.systemd-boot.consoleMode = mkForce "0";
|
||||
|
||||
boot.binfmt.emulatedSystems = ["aarch64-linux"];
|
||||
|
@ -70,15 +75,36 @@ in {
|
|||
|
||||
services.unbound = import ./unbound.nix;
|
||||
|
||||
# Disable dedicated GPU, use integrated Intel GPU to save battery
|
||||
# Set default brightness to 50%
|
||||
# https://ubuntuforums.org/showthread.php?t=2409856
|
||||
services.cron.systemCronJobs = [
|
||||
"@reboot root ${pkgs.util-linux}/bin/rfkill block bluetooth"
|
||||
"@reboot root ${pkgs.coreutils}/bin/sleep 10; ${pkgs.coreutils}/bin/echo OFF > /sys/kernel/debug/vgaswitcheroo/switch"
|
||||
"@reboot root ${pkgs.coreutils}/bin/sleep 11; ${pkgs.coreutils}/bin/echo 510 > /sys/class/backlight/gmux_backlight/brightness"
|
||||
];
|
||||
|
||||
# Disable dedicated GPU, use integrated Intel GPU to save battery
|
||||
# https://github.com/NixOS/nixpkgs/pull/33915
|
||||
systemd.services."amd-hybrid-graphics" = {
|
||||
path = [pkgs.bash];
|
||||
description = "Disable AMD Card";
|
||||
after = ["sys-kernel-debug.mount"];
|
||||
before = ["systemd-vconsole-setup.service" "display-manager.service"];
|
||||
requires = ["sys-kernel-debug.mount" "vgaswitcheroo.path"];
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
RemainAfterExit = true;
|
||||
ExecStart = "${pkgs.bash}/bin/sh -c 'echo -e \"IGD\\nOFF\" > /sys/kernel/debug/vgaswitcheroo/switch'";
|
||||
ExecStop = "${pkgs.bash}/bin/sh -c 'echo ON >/sys/kernel/debug/vgaswitcheroo/switch'";
|
||||
};
|
||||
};
|
||||
systemd.paths."vgaswitcheroo" = {
|
||||
pathConfig = {
|
||||
PathExists = "/sys/kernel/debug/vgaswitcheroo/switch";
|
||||
Unit = "amd-hybrid-graphics.service";
|
||||
};
|
||||
wantedBy = ["multi-user.target"];
|
||||
};
|
||||
|
||||
# Increase console font size for HiDPI display
|
||||
console = {
|
||||
earlySetup = true;
|
||||
|
@ -102,8 +128,8 @@ in {
|
|||
powerDownCommands = lib.mkBefore "${pkgs.kmod}/bin/rmmod brcmfmac";
|
||||
};
|
||||
|
||||
# change lid switch behaviour
|
||||
#services.logind.lidSwitch = "hibernate";
|
||||
# Change lid switch behaviour
|
||||
services.logind.lidSwitch = "hibernate";
|
||||
|
||||
# TLP for power management
|
||||
services.tlp = {
|
||||
|
@ -142,8 +168,6 @@ in {
|
|||
};
|
||||
|
||||
# WLAN frequency compliance (e.g. check for radar with DFS)
|
||||
#
|
||||
# Radeon driver seems to work better than amdgpu with Radeon R9 M370X
|
||||
hardware.firmware = with pkgs; [wireless-regdb];
|
||||
boot.extraModprobeConfig = ''
|
||||
options cfg80211 ieee80211_regdom="DE"
|
||||
|
|
Loading…
Reference in a new issue