2023-02-27 11:10:00 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
cfg = config.services.copyq;
|
|
|
|
|
|
|
|
in {
|
|
|
|
meta.maintainers = [ lib.maintainers.DamienCassou ];
|
|
|
|
|
|
|
|
options.services.copyq = {
|
2023-06-30 23:30:13 +00:00
|
|
|
enable = lib.mkEnableOption
|
|
|
|
(lib.mdDoc "CopyQ, a clipboard manager with advanced features");
|
2023-02-27 11:10:00 +00:00
|
|
|
|
2023-07-01 09:41:32 +00:00
|
|
|
package = lib.mkPackageOptionMD pkgs "copyq" { };
|
2023-02-27 11:10:00 +00:00
|
|
|
|
|
|
|
systemdTarget = lib.mkOption {
|
|
|
|
type = lib.types.str;
|
|
|
|
default = "graphical-session.target";
|
|
|
|
example = "sway-session.target";
|
2023-06-30 23:30:13 +00:00
|
|
|
description = lib.mdDoc ''
|
2023-04-17 00:14:24 +00:00
|
|
|
The systemd target that will automatically start the CopyQ service.
|
2023-06-30 23:30:13 +00:00
|
|
|
|
|
|
|
When setting this value to `"sway-session.target"`,
|
|
|
|
make sure to also enable {option}`wayland.windowManager.sway.systemd.enable`,
|
2023-02-27 11:10:00 +00:00
|
|
|
otherwise the service may never be started.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
|
|
assertions = [
|
|
|
|
(lib.hm.assertions.assertPlatform "services.copyq" pkgs
|
|
|
|
lib.platforms.linux)
|
|
|
|
];
|
|
|
|
|
|
|
|
home.packages = [ cfg.package ];
|
|
|
|
|
|
|
|
systemd.user.services.copyq = {
|
|
|
|
Unit = {
|
|
|
|
Description = "CopyQ clipboard management daemon";
|
|
|
|
PartOf = [ "graphical-session.target" ];
|
|
|
|
After = [ "graphical-session.target" ];
|
|
|
|
};
|
|
|
|
|
|
|
|
Service = {
|
|
|
|
ExecStart = "${cfg.package}/bin/copyq";
|
|
|
|
Restart = "on-failure";
|
2023-03-31 07:30:53 +00:00
|
|
|
Environment = [ "QT_QPA_PLATFORM=xcb" ];
|
2023-02-27 11:10:00 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
Install = { WantedBy = [ cfg.systemdTarget ]; };
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|