2014-05-05 19:58:51 +01:00
|
|
|
{ config, pkgs, lib, ... }:
|
2013-11-08 17:13:08 +00:00
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
###### interface
|
|
|
|
|
|
|
|
options = {
|
|
|
|
|
2014-05-05 19:58:51 +01:00
|
|
|
hardware.amdHybridGraphics.disable = lib.mkOption {
|
2013-11-08 17:13:08 +00:00
|
|
|
default = false;
|
2014-05-05 19:58:51 +01:00
|
|
|
type = lib.types.bool;
|
2013-11-08 17:13:08 +00:00
|
|
|
description = ''
|
|
|
|
Completely disable the AMD graphics card and use the
|
|
|
|
integrated graphics processor instead.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
###### implementation
|
|
|
|
|
2014-05-05 19:58:51 +01:00
|
|
|
config = lib.mkIf config.hardware.amdHybridGraphics.disable {
|
2013-11-08 17:13:08 +00:00
|
|
|
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'";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|