summaryrefslogtreecommitdiff
path: root/hm/conf/clip.nix
blob: 4db661b207303e355d1662486d071d146c3a74ce (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
{ config, lib, pkgs, ... }:
let
  cfg = config.hm.conf.clip;
in
{
  options.hm.conf.clip = {
    enable = lib.mkEnableOption "cliphist clipboard history";
    
    backend = lib.mkOption {
      type = lib.types.enum [ "wayland" "x11" "both" ];
      default = "both";
      description = "which clipboard backend tools to install";
    };
  };
  config = lib.mkIf cfg.enable {
    services.cliphist = {
      enable = true;
      allowImages = true;
      systemdTargets = "graphical-session.target";
    };

    home.packages = lib.mkMerge [
      (lib.mkIf (cfg.backend == "wayland" || cfg.backend == "both") [
        pkgs.wl-clipboard
      ])
      (lib.mkIf (cfg.backend == "x11" || cfg.backend == "both") [
        pkgs.xclip
      ])
    ];
  };
}