summary refs log tree commit diff
path: root/nixos/modules/services/hardware/amd-hybrid-graphics.nix
diff options
context:
space:
mode:
authorPeter Simons <simons@cryp.to>2013-12-04 18:33:45 +0100
committerPeter Simons <simons@cryp.to>2013-12-04 18:33:52 +0100
commitc32bf83301bc4063df924ee442d8e35c1b96d912 (patch)
tree5a0821f9960cfa2508fc6b451fbaf8bfa6326367 /nixos/modules/services/hardware/amd-hybrid-graphics.nix
parent88c7b4c7fee42c1ae5167fd1e7806d600e4451e4 (diff)
parent41f0e6ad9203a1859996e53323321a758c1fc7c4 (diff)
downloadnixlib-c32bf83301bc4063df924ee442d8e35c1b96d912.tar
nixlib-c32bf83301bc4063df924ee442d8e35c1b96d912.tar.gz
nixlib-c32bf83301bc4063df924ee442d8e35c1b96d912.tar.bz2
nixlib-c32bf83301bc4063df924ee442d8e35c1b96d912.tar.lz
nixlib-c32bf83301bc4063df924ee442d8e35c1b96d912.tar.xz
nixlib-c32bf83301bc4063df924ee442d8e35c1b96d912.tar.zst
nixlib-c32bf83301bc4063df924ee442d8e35c1b96d912.zip
Merge remote-tracking branch 'origin/master' into stdenv-updates.
Conflicts:
	pkgs/development/interpreters/perl/5.16/default.nix
	pkgs/tools/networking/curl/default.nix
	pkgs/top-level/all-packages.nix
	pkgs/top-level/release-python.nix
	pkgs/top-level/release-small.nix
	pkgs/top-level/release.nix
Diffstat (limited to 'nixos/modules/services/hardware/amd-hybrid-graphics.nix')
-rw-r--r--nixos/modules/services/hardware/amd-hybrid-graphics.nix39
1 files changed, 39 insertions, 0 deletions
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 000000000000..d938867186d0
--- /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'";
+      };
+    };
+  };
+
+}