Files
nix/hosts/common/configs/user/gui/cliphist/default.nix
Nikolaos Karaolidis 184aa4da8f Update
Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
2025-07-13 23:33:27 +01:00

89 lines
2.2 KiB
Nix

{ user, home }:
{
config,
lib,
pkgs,
...
}:
let
hmConfig = config.home-manager.users.${user};
in
{
environment.persistence."/persist/cache"."${home}/.cache/cliphist" = { };
home-manager.users.${user} = {
home.packages = with pkgs; [ cliphist ];
systemd.user.services = {
cliphist = {
Unit = {
Description = "Clipboard manager";
After = [
"graphical-session.target"
config.environment.persistence."/persist/cache"."${home}/.cache/cliphist".mount
];
PartOf = [ "graphical-session.target" ];
};
Service = {
ExecStart = lib.meta.getExe (
pkgs.writeShellApplication {
name = "init-cliphist";
runtimeInputs = with pkgs; [
wl-clipboard
cliphist
];
text = "exec wl-paste --watch cliphist store";
}
);
Restart = "on-failure";
};
Install.WantedBy = [ "graphical-session.target" ];
};
cliphist-image = {
Unit = {
Description = "Clipboard manager (images)";
After = [
"graphical-session.target"
config.environment.persistence."/persist/cache"."${home}/.cache/cliphist".mount
];
PartOf = [ "graphical-session.target" ];
};
Service = {
ExecStart = lib.meta.getExe (
pkgs.writeShellApplication {
name = "init-cliphist-image";
runtimeInputs = with pkgs; [
wl-clipboard
cliphist
];
text = "exec wl-paste --type image --watch cliphist store";
}
);
Restart = "on-failure";
};
Install.WantedBy = [ "graphical-session.target" ];
};
};
wayland.windowManager.hyprland.settings.bind =
let
cliphist-rofi = lib.meta.getExe (
import ./rofi.nix {
rofi = hmConfig.programs.rofi.finalPackage;
inherit pkgs lib;
}
);
cliphist = lib.meta.getExe pkgs.cliphist;
in
[
"$mod, v, exec, ${cliphist-rofi}"
"$mod_Ctrl, v, exec, ${cliphist} wipe"
];
};
}