about summary refs log tree commit diff
path: root/nixos/modules/hardware/video/switcheroo-control.nix
blob: 982388f8e5f4ed9def0d39bfde606bb8b7179e00 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
{ config, pkgs, lib, ... }:

with lib;
let
  pkg = [ pkgs.switcheroo-control ];
  cfg = config.services.switcherooControl;
in {
  options.services.switcherooControl = {
    enable = mkEnableOption (lib.mdDoc "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" ];
  };
}