copyq: add module

This commit is contained in:
Damien Cassou 2023-02-27 12:10:00 +01:00 committed by Robert Helgesson
parent e60080ddfb
commit 486ba3de4e
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89
4 changed files with 65 additions and 0 deletions

2
.github/CODEOWNERS vendored
View file

@ -390,6 +390,8 @@ Makefile @thiagokokada
/modules/services/clipmenu.nix @DamienCassou
/modules/services/copyq.nix @DamienCassou
/modules/services/devilspie2.nix @dawidsowa
/tests/modules/services/devilspie2 @dawidsowa

View file

@ -956,6 +956,14 @@ in
A new module is available: 'services.listenbrainz-mpd'.
'';
}
{
time = "2023-03-22T07:31:38+00:00";
condition = hostPlatform.isLinux;
message = ''
A new module is available: 'services.copyq'.
'';
}
];
};
}

View file

@ -215,6 +215,7 @@ let
./services/cbatticon.nix
./services/clipman.nix
./services/clipmenu.nix
./services/copyq.nix
./services/devilspie2.nix
./services/dropbox.nix
./services/dunst.nix

View file

@ -0,0 +1,54 @@
{ 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 = ''
The systemd target that will automatically start the Waybar service.
</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";
};
Install = { WantedBy = [ cfg.systemdTarget ]; };
};
};
}