pbgopy: add service
This commit is contained in:
parent
e3828769e8
commit
e6a58a7e71
3
.github/CODEOWNERS
vendored
3
.github/CODEOWNERS
vendored
|
@ -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
|
||||
|
|
|
@ -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'.
|
||||
'';
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -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; })
|
||||
|
|
40
modules/services/pbgopy.nix
Normal file
40
modules/services/pbgopy.nix
Normal 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" ]; };
|
||||
};
|
||||
};
|
||||
}
|
|
@ -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
|
||||
|
|
1
tests/modules/services/pbgopy/default.nix
Normal file
1
tests/modules/services/pbgopy/default.nix
Normal file
|
@ -0,0 +1 @@
|
|||
{ pbgopy = import ./service.nix; }
|
22
tests/modules/services/pbgopy/service.nix
Normal file
22
tests/modules/services/pbgopy/service.nix
Normal 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'
|
||||
'';
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue