aboutsummaryrefslogtreecommitdiff
path: root/home-manager/modules/services/clipmenu.nix
blob: 2e1c10e43d8600b3fc6983e55f923dc970a78981 (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
{ config, lib, pkgs, ... }:

with lib;

let

  cfg = config.services.clipmenu;

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

  options.services.clipmenu = {
    enable = mkEnableOption "clipmenu, the clipboard management daemon";

    package = mkOption {
      type = types.package;
      default = pkgs.clipmenu;
      defaultText = "pkgs.clipmenu";
      description = "clipmenu derivation to use.";
    };
  };

  config = mkIf cfg.enable {
    home.packages = [ cfg.package ];

    systemd.user.services.clipmenu = {
      Unit = {
        Description = "Clipboard management daemon";
        After = [ "graphical-session.target" ];
      };

      Service = {
        ExecStart = "${cfg.package}/bin/clipmenud";
        Environment = "PATH=${
            makeBinPath
            (with pkgs; [ coreutils findutils gnugrep gnused systemd ])
          }";
      };

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