home-manager/modules/services/parcellite.nix
Nick Hu 4f70f49cec
Add systemd target tray.target (#2027)
This target is for systemd units that require a system tray to be
running.

This also fixes taffybar.service: previously, systemd would consider it
to be active (running) before it was actually ready to accept tray
icons.
2021-05-22 03:15:12 +01:00

44 lines
1,007 B
Nix

{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.parcellite;
in {
meta.maintainers = [ maintainers.gleber ];
options.services.parcellite = {
enable = mkEnableOption "Parcellite";
package = mkOption {
type = types.package;
default = pkgs.parcellite;
defaultText = literalExample "pkgs.parcellite";
example = literalExample "pkgs.clipit";
description = "Parcellite derivation to use.";
};
};
config = mkIf cfg.enable {
home.packages = [ cfg.package ];
systemd.user.services.parcellite = {
Unit = {
Description = "Lightweight GTK+ clipboard manager";
Requires = [ "tray.target" ];
After = [ "graphical-session-pre.target" "tray.target" ];
PartOf = [ "graphical-session.target" ];
};
Install = { WantedBy = [ "graphical-session.target" ]; };
Service = {
ExecStart = "${cfg.package}/bin/${cfg.package.pname}";
Restart = "on-abort";
};
};
};
}