Files
nix/hosts/common/configs/user/gui/cliphist/default.nix
Nikolaos Karaolidis 0ae8128304 Refactor packages
Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
2025-02-23 23:52:29 +00:00

86 lines
2.1 KiB
Nix

{
user ? throw "user argument is required",
home ? throw "home argument is required",
}:
{
config,
lib,
pkgs,
...
}:
let
hmConfig = config.home-manager.users.${user};
in
{
environment.persistence."/cache"."${home}/.cache/cliphist" = { };
home-manager.users.${user} = {
home.packages = with pkgs; [ cliphist ];
systemd.user.services = {
cliphist = {
Unit = {
Description = "Clipboard manager";
BindsTo = [ "graphical-session.target" ];
After = [
"graphical-session.target"
config.environment.persistence."/cache"."${home}/.cache/cliphist".mount
];
};
Service.ExecStart = lib.meta.getExe (
pkgs.writeShellApplication {
name = "init-cliphist";
runtimeInputs = with pkgs; [
wl-clipboard
cliphist
];
text = "exec wl-paste --watch cliphist store";
}
);
Install.WantedBy = [ "graphical-session.target" ];
};
cliphist-image = {
Unit = {
Description = "Clipboard manager (images)";
BindsTo = [ "graphical-session.target" ];
After = [
"graphical-session.target"
config.environment.persistence."/cache"."${home}/.cache/cliphist".mount
];
};
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";
}
);
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"
];
};
}