aboutsummaryrefslogtreecommitdiff
path: root/home-manager/modules/services/status-notifier-watcher.nix
blob: 3c3e54877b4953be52fcadb0791591885eea63fb (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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
{ config, lib, pkgs, ... }:

with lib;

let

  cfg = config.services.status-notifier-watcher;

in {
  meta.maintainers = [ maintainers.pltanton ];

  options = {
    services.status-notifier-watcher = {
      enable = mkEnableOption "Status Notifier Watcher";

      package = mkOption {
        default = pkgs.haskellPackages.status-notifier-item;
        defaultText =
          literalExample "pkgs.haskellPackages.status-notifier-item";
        type = types.package;
        example = literalExample "pkgs.haskellPackages.status-notifier-item";
        description =
          "The package to use for the status notifier watcher binary.";
      };
    };
  };

  config = mkIf cfg.enable {
    systemd.user.services.status-notifier-watcher = {
      Unit = {
        Description = "SNI watcher";
        After = [ "graphical-session-pre.target" ];
        PartOf = [ "graphical-session.target" ];
        Before = [ "taffybar.service" ];
      };

      Service = { ExecStart = "${cfg.package}/bin/status-notifier-watcher"; };

      Install = {
        WantedBy = [ "graphical-session.target" "taffybar.service" ];
      };
    };
  };
}