at master 570 B view raw
1{ 2 config, 3 pkgs, 4 lib, 5 ... 6}: 7 8let 9 cfg = config.services.switcherooControl; 10in 11{ 12 options.services.switcherooControl = { 13 enable = lib.mkEnableOption "switcheroo-control, a D-Bus service to check the availability of dual-GPU"; 14 package = lib.mkPackageOption pkgs "switcheroo-control" { }; 15 }; 16 17 config = lib.mkIf cfg.enable { 18 services.dbus.packages = [ cfg.package ]; 19 environment.systemPackages = [ cfg.package ]; 20 systemd = { 21 packages = [ cfg.package ]; 22 targets.multi-user.wants = [ "switcheroo-control.service" ]; 23 }; 24 }; 25}