summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorJan Tojnar <jtojnar@gmail.com>2021-02-05 18:05:39 +0100
committerGitHub <noreply@github.com>2021-02-05 18:05:39 +0100
commit493bbc968b89c942d34d2c46fe12e9ac1c77764e (patch)
treebbda222daa81c7ea963b669562fc0b27b1d095b4 /nixos
parentc25f19bd15c6d7ddbb26aa43a53f8c57b1d0c4c9 (diff)
parentf5f9a069d9d95e7f1b2f5f2aea84a1d9b9411e52 (diff)
downloadnixpkgs-493bbc968b89c942d34d2c46fe12e9ac1c77764e.tar
nixpkgs-493bbc968b89c942d34d2c46fe12e9ac1c77764e.tar.gz
nixpkgs-493bbc968b89c942d34d2c46fe12e9ac1c77764e.tar.bz2
nixpkgs-493bbc968b89c942d34d2c46fe12e9ac1c77764e.tar.lz
nixpkgs-493bbc968b89c942d34d2c46fe12e9ac1c77764e.tar.xz
nixpkgs-493bbc968b89c942d34d2c46fe12e9ac1c77764e.tar.zst
nixpkgs-493bbc968b89c942d34d2c46fe12e9ac1c77764e.zip
Merge pull request #95337 from pasqui23/switchctl
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/hardware/video/switcheroo-control.nix18
1 files changed, 18 insertions, 0 deletions
diff --git a/nixos/modules/hardware/video/switcheroo-control.nix b/nixos/modules/hardware/video/switcheroo-control.nix
new file mode 100644
index 00000000000..199adb2ad8f
--- /dev/null
+++ b/nixos/modules/hardware/video/switcheroo-control.nix
@@ -0,0 +1,18 @@
+{ config, pkgs, lib, ... }:
+
+with lib;
+let
+  pkg = [ pkgs.switcheroo-control ];
+  cfg = config.services.switcherooControl;
+in {
+  options.services.switcherooControl = {
+    enable = mkEnableOption "switcheroo-control, a D-Bus service to check the availability of dual-GPU";
+  };
+
+  config = mkIf cfg.enable {
+    services.dbus.packages = pkg;
+    environment.systemPackages = pkg;
+    systemd.packages = pkg;
+    systemd.targets.multi-user.wants = [ "switcheroo-control.service" ];
+  };
+}