Skip to content

espanso: add option to install Espanso plugins (packages) #6943

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion modules/services/espanso.nix
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ in
lib.hm.maintainers.liyangau
maintainers.n8henrie
maintainers.phanirithvij
maintainers.delafthi
];
options = {
services.espanso = {
Expand Down Expand Up @@ -150,6 +151,16 @@ in
for a description of available options.
'';
};

plugins = mkOption {
type = with types; listOf package;
default = [ ];
example = literalExpression "[ pkgs.espansoPlugins.actually-all-emojis-spaces ]";
description = ''
List of Espanso plugins to install. To get a list of supported plugins run:
{command}`nix-env -f '<nixpkgs>' -qaP -A espansoPlugins`.
'';
};
};
};

Expand Down Expand Up @@ -186,8 +197,16 @@ in
source = yaml.generate "${name}.yml" value;
};
}) cfg.matches;
plugins = lib.listToAttrs (
lib.map (plugin: {
name = "espanso/match/packages/${plugin.pname}";
value = {
source = plugin;
};
}) cfg.plugins
);
in
configFiles // matchesFiles;
configFiles // matchesFiles // plugins;

systemd.user.services.espanso = {
Unit = {
Expand Down
4 changes: 4 additions & 0 deletions tests/modules/services/espanso-darwin/basic-configuration.nix
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{ pkgs, ... }:
{
services.espanso = {
enable = true;
Expand Down Expand Up @@ -42,6 +43,9 @@
];
};
};
plugins = [
pkgs.espansoPlugins.dummy-package
];
};

nmt.script = ''
Expand Down
7 changes: 6 additions & 1 deletion tests/modules/services/espanso/basic-configuration.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
espansoExtraArgs: {
espansoExtraArgs:
{ pkgs, ... }:
{
services.espanso = {
enable = true;
configs = {
Expand Down Expand Up @@ -42,6 +44,9 @@ espansoExtraArgs: {
];
};
};
plugins = [
pkgs.espansoPlugins.dummy-package
];
} // espansoExtraArgs;

nmt.script = ''
Expand Down
Loading