parent
e3828769e8
commit
e6a58a7e71
@ -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" ]; }; |
||||
}; |
||||
}; |
||||
} |
@ -0,0 +1 @@ |
||||
{ pbgopy = import ./service.nix; } |
@ -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 new issue