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