{ config, lib, pkgs, ... }: let cfg = config.szpont.hm.conf.clipboard; in { options.szpont.hm.conf.clipboard = { 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 ]) ]; }; }