Add a nix module for AMD Hybrid Graphics
This commit is contained in:
parent
fa9284b941
commit
f48af13c5a
@ -91,6 +91,7 @@
|
|||||||
./services/databases/virtuoso.nix
|
./services/databases/virtuoso.nix
|
||||||
./services/games/ghost-one.nix
|
./services/games/ghost-one.nix
|
||||||
./services/hardware/acpid.nix
|
./services/hardware/acpid.nix
|
||||||
|
./services/hardware/amd-hybrid-graphics.nix
|
||||||
./services/hardware/bluetooth.nix
|
./services/hardware/bluetooth.nix
|
||||||
./services/hardware/nvidia-optimus.nix
|
./services/hardware/nvidia-optimus.nix
|
||||||
./services/hardware/pcscd.nix
|
./services/hardware/pcscd.nix
|
||||||
|
39
nixos/modules/services/hardware/amd-hybrid-graphics.nix
Normal file
39
nixos/modules/services/hardware/amd-hybrid-graphics.nix
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
{ config, pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
|
||||||
|
###### interface
|
||||||
|
|
||||||
|
options = {
|
||||||
|
|
||||||
|
hardware.amdHybridGraphics.disable = pkgs.lib.mkOption {
|
||||||
|
default = false;
|
||||||
|
type = pkgs.lib.types.bool;
|
||||||
|
description = ''
|
||||||
|
Completely disable the AMD graphics card and use the
|
||||||
|
integrated graphics processor instead.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
###### implementation
|
||||||
|
|
||||||
|
config = pkgs.lib.mkIf config.hardware.amdHybridGraphics.disable {
|
||||||
|
systemd.services."amd-hybrid-graphics" = {
|
||||||
|
path = [ pkgs.bash ];
|
||||||
|
description = "Disable AMD Card";
|
||||||
|
after = [ "sys-kernel-debug.mount" ];
|
||||||
|
requires = [ "sys-kernel-debug.mount" ];
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
serviceConfig = {
|
||||||
|
Type = "oneshot";
|
||||||
|
RemainAfterExit = true;
|
||||||
|
ExecStart = "${pkgs.bash}/bin/sh -c 'echo -e \"IGD\\nOFF\" > /sys/kernel/debug/vgaswitcheroo/switch; exit 0'";
|
||||||
|
ExecStop = "${pkgs.bash}/bin/sh -c 'echo ON >/sys/kernel/debug/vgaswitcheroo/switch; exit 0'";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user