mirror of
https://github.com/nix-community/home-manager
synced 2024-11-20 10:09:45 +01:00
services.cliphist: add module (#4445)
This commit is contained in:
parent
d4a5076ea8
commit
3b67ae3f66
5 changed files with 70 additions and 0 deletions
|
@ -249,6 +249,7 @@ let
|
|||
./services/cachix-agent.nix
|
||||
./services/caffeine.nix
|
||||
./services/cbatticon.nix
|
||||
./services/cliphist.nix
|
||||
./services/clipman.nix
|
||||
./services/clipmenu.nix
|
||||
./services/comodoro.nix
|
||||
|
|
50
modules/services/cliphist.nix
Normal file
50
modules/services/cliphist.nix
Normal file
|
@ -0,0 +1,50 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
let cfg = config.services.cliphist;
|
||||
in {
|
||||
meta.maintainers = [ lib.maintainers.janik ];
|
||||
|
||||
options.services.cliphist = {
|
||||
enable =
|
||||
lib.mkEnableOption "cliphist, a clipboard history “manager” for wayland";
|
||||
|
||||
package = lib.mkPackageOption pkgs "cliphist" { };
|
||||
|
||||
systemdTarget = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "graphical-session.target";
|
||||
example = "sway-session.target";
|
||||
description = ''
|
||||
The systemd target that will automatically start the cliphist service.
|
||||
|
||||
When setting this value to `"sway-session.target"`,
|
||||
make sure to also enable {option}`wayland.windowManager.sway.systemd.enable`,
|
||||
otherwise the service may never be started.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
assertions = [
|
||||
(lib.hm.assertions.assertPlatform "services.cliphist" pkgs
|
||||
lib.platforms.linux)
|
||||
];
|
||||
|
||||
home.packages = [ cfg.package ];
|
||||
|
||||
systemd.user.services.cliphist = {
|
||||
Unit = {
|
||||
Description = "Clipboard management daemon";
|
||||
PartOf = [ "graphical-session.target" ];
|
||||
};
|
||||
|
||||
Service = {
|
||||
Type = "simple";
|
||||
ExecStart =
|
||||
"${pkgs.wl-clipboard}/bin/wl-paste --watch ${cfg.package}/bin/cliphist store";
|
||||
Restart = "on-failure";
|
||||
};
|
||||
|
||||
Install = { WantedBy = [ cfg.systemdTarget ]; };
|
||||
};
|
||||
};
|
||||
}
|
|
@ -205,6 +205,7 @@ import nmt {
|
|||
./modules/services/barrier
|
||||
./modules/services/borgmatic
|
||||
./modules/services/cachix-agent
|
||||
./modules/services/cliphist
|
||||
./modules/services/clipman
|
||||
./modules/services/comodoro
|
||||
./modules/services/devilspie2
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
services.cliphist = {
|
||||
enable = true;
|
||||
systemdTarget = "sway-session.target";
|
||||
};
|
||||
|
||||
test.stubs = {
|
||||
cliphist = { };
|
||||
wl-clipboard = { };
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.config/systemd/user/cliphist.service
|
||||
'';
|
||||
}
|
1
tests/modules/services/cliphist/default.nix
Normal file
1
tests/modules/services/cliphist/default.nix
Normal file
|
@ -0,0 +1 @@
|
|||
{ cliphist-sway-session-target = ./cliphist-sway-session-target.nix; }
|
Loading…
Reference in a new issue