about summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorOPNA2608 <christoph.neidahl@gmail.com>2023-10-19 20:26:53 +0200
committerOPNA2608 <christoph.neidahl@gmail.com>2023-10-20 14:10:48 +0200
commitaba2b6d387dcbe2f8e06de7140442a8459220b34 (patch)
tree616c04ae3b70958f9247f4b28b74826be97cadf2 /nixos
parentfa4581f1efbc6315ab111f5c7ab3022c237f5a44 (diff)
downloadnixlib-aba2b6d387dcbe2f8e06de7140442a8459220b34.tar
nixlib-aba2b6d387dcbe2f8e06de7140442a8459220b34.tar.gz
nixlib-aba2b6d387dcbe2f8e06de7140442a8459220b34.tar.bz2
nixlib-aba2b6d387dcbe2f8e06de7140442a8459220b34.tar.lz
nixlib-aba2b6d387dcbe2f8e06de7140442a8459220b34.tar.xz
nixlib-aba2b6d387dcbe2f8e06de7140442a8459220b34.tar.zst
nixlib-aba2b6d387dcbe2f8e06de7140442a8459220b34.zip
nixos/ayatana-indicators: init module
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/module-list.nix1
-rw-r--r--nixos/modules/services/desktops/ayatana-indicators.nix58
2 files changed, 59 insertions, 0 deletions
diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix
index 2c06f4931725..438da244ab7d 100644
--- a/nixos/modules/module-list.nix
+++ b/nixos/modules/module-list.nix
@@ -437,6 +437,7 @@
   ./services/databases/surrealdb.nix
   ./services/databases/victoriametrics.nix
   ./services/desktops/accountsservice.nix
+  ./services/desktops/ayatana-indicators.nix
   ./services/desktops/bamf.nix
   ./services/desktops/blueman.nix
   ./services/desktops/cpupower-gui.nix
diff --git a/nixos/modules/services/desktops/ayatana-indicators.nix b/nixos/modules/services/desktops/ayatana-indicators.nix
new file mode 100644
index 000000000000..abc687bbd43d
--- /dev/null
+++ b/nixos/modules/services/desktops/ayatana-indicators.nix
@@ -0,0 +1,58 @@
+{ config
+, pkgs
+, lib
+, ...
+}:
+
+let
+  cfg = config.services.ayatana-indicators;
+in
+{
+  options.services.ayatana-indicators = {
+    enable = lib.mkEnableOption (lib.mdDoc ''
+      Ayatana Indicators, a continuation of Canonical's Application Indicators
+    '');
+
+    packages = lib.mkOption {
+      type = lib.types.listOf lib.types.package;
+      default = [ ];
+      example = lib.literalExpression "with pkgs; [ ayatana-indicator-messages ]";
+      description = lib.mdDoc ''
+        List of packages containing Ayatana Indicator services
+        that should be brought up by the SystemD "ayatana-indicators" user target.
+
+        Packages specified here must have passthru.ayatana-indicators set correctly.
+
+        If, how, and where these indicators are displayed will depend on your DE.
+      '';
+    };
+  };
+
+  config = lib.mkIf cfg.enable {
+    environment = {
+      systemPackages = cfg.packages;
+
+      pathsToLink = [
+        "/share/ayatana"
+      ];
+    };
+
+    # libayatana-common's ayatana-indicators.target with explicit Wants & Before to bring up requested indicator services
+    systemd.user.targets."ayatana-indicators" =
+      let
+        indicatorServices = lib.lists.flatten
+          (map
+            (pkg:
+              (map (ind: "${ind}.service") pkg.passthru.ayatana-indicators))
+            cfg.packages);
+      in
+      {
+        description = "Target representing the lifecycle of the Ayatana Indicators. Each indicator should be bound to it in its individual service file";
+        partOf = [ "graphical-session.target" ];
+        wants = indicatorServices;
+        before = indicatorServices;
+      };
+  };
+
+  meta.maintainers = with lib.maintainers; [ OPNA2608 ];
+}