about summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorWeijia Wang <9713184+wegank@users.noreply.github.com>2024-02-26 07:56:34 +0100
committerGitHub <noreply@github.com>2024-02-26 07:56:34 +0100
commit9798dc0a4816a39793140236ead75f7b801a68e3 (patch)
tree96c17ea3c534f4b8eeb13246ed9dceaa0d7b915c /nixos
parent54f587622de83f02e8c03095dc58e812b5c3f5d1 (diff)
parentd70c353c1646a35fc5e586c06cd6d1b78f67e839 (diff)
downloadnixlib-9798dc0a4816a39793140236ead75f7b801a68e3.tar
nixlib-9798dc0a4816a39793140236ead75f7b801a68e3.tar.gz
nixlib-9798dc0a4816a39793140236ead75f7b801a68e3.tar.bz2
nixlib-9798dc0a4816a39793140236ead75f7b801a68e3.tar.lz
nixlib-9798dc0a4816a39793140236ead75f7b801a68e3.tar.xz
nixlib-9798dc0a4816a39793140236ead75f7b801a68e3.tar.zst
nixlib-9798dc0a4816a39793140236ead75f7b801a68e3.zip
Merge pull request #291464 from Gerg-L/switcheroo2
nixos/switcherooControl: add package option
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/hardware/video/switcheroo-control.nix17
1 files changed, 9 insertions, 8 deletions
diff --git a/nixos/modules/hardware/video/switcheroo-control.nix b/nixos/modules/hardware/video/switcheroo-control.nix
index 982388f8e5f4..967120d6744a 100644
--- a/nixos/modules/hardware/video/switcheroo-control.nix
+++ b/nixos/modules/hardware/video/switcheroo-control.nix
@@ -1,18 +1,19 @@
 { 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");
+    enable = lib.mkEnableOption "switcheroo-control, a D-Bus service to check the availability of dual-GPU";
+    package = lib.mkPackageOption pkgs "switcheroo-control" { };
   };
 
-  config = mkIf cfg.enable {
-    services.dbus.packages = pkg;
-    environment.systemPackages = pkg;
-    systemd.packages = pkg;
-    systemd.targets.multi-user.wants = [ "switcheroo-control.service" ];
+  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" ];
+    };
   };
 }