summaryrefslogtreecommitdiffstats
path: root/nixos/modules/hardware/video/switcheroo-control.nix
blob: 7cc54c032dc3fbbbd88f104155b057dfa44b06cd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
{
  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" ];
    };
  };
}