mirror of
https://github.com/nix-community/home-manager
synced 2024-11-22 12:43:14 +00:00
clipman: add module
This commit is contained in:
parent
8745cc9a21
commit
fb49fbc368
9 changed files with 111 additions and 0 deletions
3
.github/CODEOWNERS
vendored
3
.github/CODEOWNERS
vendored
|
@ -369,6 +369,9 @@ Makefile @thiagokokada
|
|||
|
||||
/modules/services/cbatticon.nix @pmiddend
|
||||
|
||||
/modules/services/clipman.nix @jwygoda
|
||||
/tests/modules/services/clipman @jwygoda
|
||||
|
||||
/modules/services/clipmenu.nix @DamienCassou
|
||||
|
||||
/modules/services/devilspie2.nix @dawidsowa
|
||||
|
|
|
@ -233,6 +233,12 @@
|
|||
githubId = 1553581;
|
||||
name = "Josh Robson Chase";
|
||||
};
|
||||
jwygoda = {
|
||||
name = "Jarosław Wygoda";
|
||||
email = "jaroslaw@wygoda.me";
|
||||
github = "jwygoda";
|
||||
githubId = 20658981;
|
||||
};
|
||||
hawkw = {
|
||||
name = "Eliza Weisman";
|
||||
email = "eliza@elizas.website";
|
||||
|
|
|
@ -869,6 +869,14 @@ in
|
|||
A new module is available: 'services.cachix-agent'.
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2022-12-28T21:48:22+00:00";
|
||||
condition = hostPlatform.isLinux;
|
||||
message = ''
|
||||
A new module is available: 'services.clipman'.
|
||||
'';
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -207,6 +207,7 @@ let
|
|||
./services/cachix-agent.nix
|
||||
./services/caffeine.nix
|
||||
./services/cbatticon.nix
|
||||
./services/clipman.nix
|
||||
./services/clipmenu.nix
|
||||
./services/devilspie2.nix
|
||||
./services/dropbox.nix
|
||||
|
|
58
modules/services/clipman.nix
Normal file
58
modules/services/clipman.nix
Normal file
|
@ -0,0 +1,58 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
|
||||
cfg = config.services.clipman;
|
||||
|
||||
in {
|
||||
meta.maintainers = [ maintainers.jwygoda ];
|
||||
|
||||
options.services.clipman = {
|
||||
enable = mkEnableOption "clipman, a simple clipboard manager for Wayland";
|
||||
|
||||
package = mkPackageOption pkgs "clipman" { };
|
||||
|
||||
systemdTarget = mkOption {
|
||||
type = types.str;
|
||||
default = "graphical-session.target";
|
||||
example = "sway-session.target";
|
||||
description = ''
|
||||
The systemd target that will automatically start the Waybar service.
|
||||
</para>
|
||||
<para>
|
||||
When setting this value to <literal>"sway-session.target"</literal>,
|
||||
make sure to also enable <option>wayland.windowManager.sway.systemdIntegration</option>,
|
||||
otherwise the service may never be started.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
assertions = [
|
||||
(lib.hm.assertions.assertPlatform "services.clipman" pkgs
|
||||
lib.platforms.linux)
|
||||
];
|
||||
|
||||
home.packages = [ cfg.package ];
|
||||
|
||||
systemd.user.services.clipman = {
|
||||
Unit = {
|
||||
Description = "Clipboard management daemon";
|
||||
PartOf = [ "graphical-session.target" ];
|
||||
After = [ "graphical-session.target" ];
|
||||
};
|
||||
|
||||
Service = {
|
||||
ExecStart =
|
||||
"${pkgs.wl-clipboard}/bin/wl-paste -t text --watch ${cfg.package}/bin/clipman store";
|
||||
ExecReload = "${pkgs.coreutils}/bin/kill -SIGUSR2 $MAINPID";
|
||||
Restart = "on-failure";
|
||||
KillMode = "mixed";
|
||||
};
|
||||
|
||||
Install = { WantedBy = [ cfg.systemdTarget ]; };
|
||||
};
|
||||
};
|
||||
}
|
|
@ -167,6 +167,7 @@ import nmt {
|
|||
./modules/services/barrier
|
||||
./modules/services/borgmatic
|
||||
./modules/services/cachix-agent
|
||||
./modules/services/clipman
|
||||
./modules/services/devilspie2
|
||||
./modules/services/dropbox
|
||||
./modules/services/emacs
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
home.stateVersion = "21.11";
|
||||
|
||||
services.clipman = {
|
||||
enable = true;
|
||||
systemdTarget = "sway-session.target";
|
||||
};
|
||||
|
||||
test.stubs = {
|
||||
clipman = { };
|
||||
wl-clipboard = { };
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
serviceFile=$(normalizeStorePaths home-files/.config/systemd/user/clipman.service)
|
||||
assertFileContent "$serviceFile" ${./clipman-sway-session-target.service}
|
||||
'';
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
[Install]
|
||||
WantedBy=sway-session.target
|
||||
|
||||
[Service]
|
||||
ExecReload=/nix/store/00000000000000000000000000000000-coreutils/bin/kill -SIGUSR2 $MAINPID
|
||||
ExecStart=@wl-clipboard@/bin/wl-paste -t text --watch @clipman@/bin/clipman store
|
||||
KillMode=mixed
|
||||
Restart=on-failure
|
||||
|
||||
[Unit]
|
||||
After=graphical-session.target
|
||||
Description=Clipboard management daemon
|
||||
PartOf=graphical-session.target
|
1
tests/modules/services/clipman/default.nix
Normal file
1
tests/modules/services/clipman/default.nix
Normal file
|
@ -0,0 +1 @@
|
|||
{ clipman-sway-session-target = ./clipman-sway-session-target.nix; }
|
Loading…
Reference in a new issue