2020-10-12 00:22:58 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
cfg = config.services.parcellite;
|
|
|
|
|
|
|
|
in {
|
|
|
|
meta.maintainers = [ maintainers.gleber ];
|
|
|
|
|
2021-07-02 22:36:30 +00:00
|
|
|
options.services.parcellite = {
|
|
|
|
enable = mkEnableOption "Parcellite";
|
|
|
|
|
2023-01-10 09:35:00 +00:00
|
|
|
extraOptions = mkOption {
|
|
|
|
type = types.listOf types.str;
|
|
|
|
default = [ ];
|
|
|
|
example = [ "--no-icon" ];
|
|
|
|
description = ''
|
|
|
|
Command line arguments passed to Parcellite.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2021-07-02 22:36:30 +00:00
|
|
|
package = mkOption {
|
|
|
|
type = types.package;
|
|
|
|
default = pkgs.parcellite;
|
2021-11-04 16:42:44 +00:00
|
|
|
defaultText = literalExpression "pkgs.parcellite";
|
|
|
|
example = literalExpression "pkgs.clipit";
|
2021-07-02 22:36:30 +00:00
|
|
|
description = "Parcellite derivation to use.";
|
|
|
|
};
|
2020-10-12 00:22:58 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
2021-11-04 16:42:44 +00:00
|
|
|
assertions = [
|
|
|
|
(lib.hm.assertions.assertPlatform "services.parcellite" pkgs
|
|
|
|
lib.platforms.linux)
|
|
|
|
];
|
|
|
|
|
2021-07-02 22:36:30 +00:00
|
|
|
home.packages = [ cfg.package ];
|
2020-10-12 00:22:58 +00:00
|
|
|
|
|
|
|
systemd.user.services.parcellite = {
|
|
|
|
Unit = {
|
|
|
|
Description = "Lightweight GTK+ clipboard manager";
|
2021-07-02 22:36:30 +00:00
|
|
|
Requires = [ "tray.target" ];
|
|
|
|
After = [ "graphical-session-pre.target" "tray.target" ];
|
2020-10-12 00:22:58 +00:00
|
|
|
PartOf = [ "graphical-session.target" ];
|
|
|
|
};
|
|
|
|
|
|
|
|
Install = { WantedBy = [ "graphical-session.target" ]; };
|
|
|
|
|
|
|
|
Service = {
|
2023-01-10 09:35:00 +00:00
|
|
|
ExecStart = "${cfg.package}/bin/${cfg.package.pname} ${
|
|
|
|
escapeShellArgs cfg.extraOptions
|
|
|
|
}";
|
2020-10-12 00:22:58 +00:00
|
|
|
Restart = "on-abort";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|