forked from nix-community/home-manager
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
111 additions
and
0 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 ]; }; | ||
}; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
tests/modules/services/clipman/clipman-sway-session-target.nix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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} | ||
''; | ||
} |
13 changes: 13 additions & 0 deletions
13
tests/modules/services/clipman/clipman-sway-session-target.service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{ clipman-sway-session-target = ./clipman-sway-session-target.nix; } |