diff options
author | William A. Kennington III <william@wkennington.com> | 2013-11-08 11:13:08 -0600 |
---|---|---|
committer | William A. Kennington III <william@wkennington.com> | 2013-11-20 11:27:28 -0600 |
commit | f48af13c5ac71f4f128a73b2be1168a9b5969b33 (patch) | |
tree | c9019eb4aa33abc7752e0f228a9c3e3841a3c67b /nixos | |
parent | fa9284b941cfe0ff0002d6e641096df4e04f9ac1 (diff) | |
download | nixpkgs-f48af13c5ac71f4f128a73b2be1168a9b5969b33.tar nixpkgs-f48af13c5ac71f4f128a73b2be1168a9b5969b33.tar.gz nixpkgs-f48af13c5ac71f4f128a73b2be1168a9b5969b33.tar.bz2 nixpkgs-f48af13c5ac71f4f128a73b2be1168a9b5969b33.tar.lz nixpkgs-f48af13c5ac71f4f128a73b2be1168a9b5969b33.tar.xz nixpkgs-f48af13c5ac71f4f128a73b2be1168a9b5969b33.tar.zst nixpkgs-f48af13c5ac71f4f128a73b2be1168a9b5969b33.zip |
Add a nix module for AMD Hybrid Graphics
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/modules/module-list.nix | 1 | ||||
-rw-r--r-- | nixos/modules/services/hardware/amd-hybrid-graphics.nix | 39 |
2 files changed, 40 insertions, 0 deletions
diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index caba5ef18c3..2189d0358da 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -91,6 +91,7 @@ ./services/databases/virtuoso.nix ./services/games/ghost-one.nix ./services/hardware/acpid.nix + ./services/hardware/amd-hybrid-graphics.nix ./services/hardware/bluetooth.nix ./services/hardware/nvidia-optimus.nix ./services/hardware/pcscd.nix diff --git a/nixos/modules/services/hardware/amd-hybrid-graphics.nix b/nixos/modules/services/hardware/amd-hybrid-graphics.nix new file mode 100644 index 00000000000..d938867186d --- /dev/null +++ b/nixos/modules/services/hardware/amd-hybrid-graphics.nix @@ -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'"; + }; + }; + }; + +} |