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

let
  cfg = config.services.switcherooControl;
in {
  options.services.switcherooControl = {
    enable = lib.mkEnableOption "switcheroo-control, a D-Bus service to check the availability of dual-GPU";
    package = lib.mkPackageOption pkgs "switcheroo-control" { };
  };

  config = lib.mkIf cfg.enable {
    services.dbus.packages = [ cfg.package ];
    environment.systemPackages = [ cfg.package ];
    systemd = {
      packages = [ cfg.package ];
      targets.multi-user.wants = [ "switcheroo-control.service" ];
    };
  };
}