pbgopy: add service

This commit is contained in:
Ivar 2020-12-03 03:55:37 +01:00 committed by Robert Helgesson
parent e3828769e8
commit e6a58a7e71
No known key found for this signature in database
GPG Key ID: 36BDAA14C2797E89
7 changed files with 76 additions and 0 deletions

3
.github/CODEOWNERS vendored
View File

@ -194,6 +194,9 @@
/modules/services/pasystray.nix @pltanton
/modules/services/pbgopy.nix @ivarwithoutbones
/tests/modules/services/pbgopy @ivarwithoutbones
/modules/services/pulseeffects.nix @jonringer
/modules/services/random-background.nix @rycee

View File

@ -1767,6 +1767,14 @@ in
A new module is available: 'services.wlsunset'.
'';
}
{
time = "2020-12-09T22:34:33+00:00";
condition = hostPlatform.isLinux;
message = ''
A new module is available: 'services.pbgopy'.
'';
}
];
};
}

View File

@ -169,6 +169,7 @@ let
(loadModule ./services/parcellite.nix { })
(loadModule ./services/password-store-sync.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/pasystray.nix { })
(loadModule ./services/pbgopy.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/picom.nix { })
(loadModule ./services/polybar.nix { })
(loadModule ./services/pulseeffects.nix { condition = hostPlatform.isLinux; })

View File

@ -0,0 +1,40 @@
{ 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" ]; };
};
};
}

View File

@ -95,6 +95,7 @@ import nmt {
./modules/services/fluidsynth
./modules/services/kanshi
./modules/services/lieer
./modules/services/pbgopy
./modules/services/polybar
./modules/services/sxhkd
./modules/services/window-managers/i3

View File

@ -0,0 +1 @@
{ pbgopy = import ./service.nix; }

View File

@ -0,0 +1,22 @@
{ config, pkgs, ... }: {
config = {
services.pbgopy.enable = true;
nixpkgs.overlays = [
(self: super: {
pbgopy = pkgs.writeScriptBin "dummy-pbgopy" "" // {
outPath = "@pbgopy@";
};
})
];
nmt.script = ''
serviceFile=home-files/.config/systemd/user/pbgopy.service
assertFileExists $serviceFile
assertFileContains $serviceFile \
'ExecStart=@pbgopy@/bin/pbgopy serve --ttl 24h'
'';
};
}