From 6bd7e565ab17191f724fe83a4f29a23ef05e18aa Mon Sep 17 00:00:00 2001 From: Anton Plotnikov Date: Fri, 20 Jul 2018 00:29:47 +0300 Subject: [PATCH] status-notifier-watcher: add service --- modules/modules.nix | 1 + modules/services/status-notifier-watcher.nix | 45 ++++++++++++++++++++ modules/services/taffybar.nix | 5 ++- 3 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 modules/services/status-notifier-watcher.nix diff --git a/modules/modules.nix b/modules/modules.nix index 323fe176..982dab95 100644 --- a/modules/modules.nix +++ b/modules/modules.nix @@ -73,6 +73,7 @@ let ./services/redshift.nix ./services/screen-locker.nix ./services/stalonetray.nix + ./services/status-notifier-watcher.nix ./services/syncthing.nix ./services/taffybar.nix ./services/tahoe-lafs.nix diff --git a/modules/services/status-notifier-watcher.nix b/modules/services/status-notifier-watcher.nix new file mode 100644 index 00000000..8bd0dcff --- /dev/null +++ b/modules/services/status-notifier-watcher.nix @@ -0,0 +1,45 @@ +{ 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 = "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 config.services.status-notifier-watcher.enable { + systemd.user.services.status-notifier-watcher = { + Unit = { + Description = "SNI watcher"; + After = [ "graphical-session-pre.target" ]; + PartOf = [ "graphical-session.target" ]; + }; + + Service = { + ExecStart = "${cfg.package}/bin/status-notifier-watcher"; + }; + + Install = { + WantedBy = [ "graphical-session.target" ]; + }; + }; + }; +} diff --git a/modules/services/taffybar.nix b/modules/services/taffybar.nix index b8a64240..24a3f203 100644 --- a/modules/services/taffybar.nix +++ b/modules/services/taffybar.nix @@ -29,7 +29,10 @@ in systemd.user.services.taffybar = { Unit = { Description = "Taffybar desktop bar"; - After = [ "graphical-session-pre.target" ]; + After = [ + "graphical-session-pre.target" + "status-notifier-watcher.service" + ]; PartOf = [ "graphical-session.target" ]; };