1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-01 00:39:45 +01:00
home-manager/modules/services/copyq.nix

56 lines
1.4 KiB
Nix
Raw Normal View History

2023-02-27 12:10:00 +01:00
{ config, lib, pkgs, ... }:
let
cfg = config.services.copyq;
in {
meta.maintainers = [ lib.maintainers.DamienCassou ];
options.services.copyq = {
enable =
lib.mkEnableOption "CopyQ, a clipboard manager with advanced features";
package = lib.mkPackageOption pkgs "copyq" { };
systemdTarget = lib.mkOption {
type = lib.types.str;
default = "graphical-session.target";
example = "sway-session.target";
description = ''
2023-04-17 02:14:24 +02:00
The systemd target that will automatically start the CopyQ service.
2023-02-27 12:10:00 +01:00
</para>
<para>
When setting this value to <literal>"sway-session.target"</literal>,
make sure to also enable <option>wayland.windowManager.sway.systemdIntegration</option>,
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";
Environment = [ "QT_QPA_PLATFORM=xcb" ];
2023-02-27 12:10:00 +01:00
};
Install = { WantedBy = [ cfg.systemdTarget ]; };
};
};
}