1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-05 18:59:44 +01:00
home-manager/modules/services/pbgopy.nix
2020-12-09 23:45:51 +01:00

40 lines
951 B
Nix

{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.pbgopy;
package = pkgs.pbgopy;
in {
meta.maintainers = [ maintainers.ivar ];
options.services.pbgopy = {
enable = mkEnableOption "pbgopy";
cache.ttl = mkOption {
type = types.str;
default = "24h";
example = "10m";
description = ''
The TTL for the cache. Use <literal>"0s"</literal> to disable it.
'';
};
};
config = mkIf cfg.enable {
home.packages = [ package ];
systemd.user.services.pbgopy = {
Unit = {
Description = "pbgopy server for sharing the clipboard between devices";
After = [ "graphical-session-pre.target" ];
PartOf = [ "graphical-session.target" ];
};
Service = {
ExecStart = "${package}/bin/pbgopy serve --ttl ${cfg.cache.ttl}";
Restart = "on-abort";
};
Install = { WantedBy = [ "graphical-session.target" ]; };
};
};
}