From f5f9a069d9d95e7f1b2f5f2aea84a1d9b9411e52 Mon Sep 17 00:00:00 2001 From: Pasquale Date: Thu, 13 Aug 2020 15:46:24 +0200 Subject: [PATCH] nixos/switcheroo-control: added nixos option node/switcheroo-control: better formatting --- .../hardware/video/switcheroo-control.nix | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 nixos/modules/hardware/video/switcheroo-control.nix 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" ]; + }; +}