Skip to content

Commit e6aa665

Browse files
author
Thierry Delafontaine
committed
espanso: add option to install Espanso plugins (packages)
This commit introduces support for declaring [Espanso](https://espanso.org/) packages in Nix. Packages are installed to `~/.config/espanso/match/packages/<package-name>`.
1 parent d0d9d0a commit e6aa665

File tree

4 files changed

+36
-2
lines changed

4 files changed

+36
-2
lines changed

modules/lib/maintainers.nix

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,14 @@
114114
}
115115
];
116116
};
117+
delafthi = {
118+
name = "Thierry Delafontaine";
119+
email = "[email protected]";
120+
matrix = "@delafthi:matrix.org";
121+
github = "delafthi";
122+
githubId = 50531499;
123+
keys = [ { fingerprint = "24A0 D053 B044 E46D E0BD F61F F284 24F9 874E 6696"; } ];
124+
};
117125
Dines97 = {
118126
name = "Denis Kaynar";
119127
email = "[email protected]";

modules/services/espanso.nix

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ in
5252
lib.hm.maintainers.liyangau
5353
maintainers.n8henrie
5454
maintainers.phanirithvij
55+
maintainers.delafthi
5556
];
5657
options = {
5758
services.espanso = {
@@ -155,6 +156,16 @@ in
155156
for a description of available options.
156157
'';
157158
};
159+
160+
plugins = mkOption {
161+
type = with types; listOf package;
162+
default = [ ];
163+
example = literalExpression "[ pkgs.espansoPlugins.actually-all-emojis-spaces ]";
164+
description = ''
165+
List of Espanso plugins to install. To get a list of supported plugins run:
166+
{command}`nix-env -f '<nixpkgs>' -qaP -A espansoPlugins`.
167+
'';
168+
};
158169
};
159170
};
160171

@@ -191,8 +202,16 @@ in
191202
source = yaml.generate "${name}.yml" value;
192203
};
193204
}) cfg.matches;
205+
plugins = lib.listToAttrs (
206+
lib.map (plugin: {
207+
name = "espanso/match/packages/${plugin.pname}";
208+
value = {
209+
source = plugin;
210+
};
211+
}) cfg.plugins
212+
);
194213
in
195-
configFiles // matchesFiles;
214+
configFiles // matchesFiles // plugins;
196215

197216
systemd.user.services.espanso = {
198217
Unit = {

tests/modules/services/espanso-darwin/basic-configuration.nix

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{ pkgs, ... }:
12
{
23
services.espanso = {
34
enable = true;
@@ -42,6 +43,9 @@
4243
];
4344
};
4445
};
46+
plugins = [
47+
pkgs.espansoPlugins.dummy-package
48+
];
4549
};
4650

4751
nmt.script = ''

tests/modules/services/espanso/basic-configuration.nix

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
espansoExtraArgs:
2-
{ config, ... }:
2+
{ config, pkgs, ... }:
33

44
{
55
services.espanso = {
@@ -45,6 +45,9 @@ espansoExtraArgs:
4545
];
4646
};
4747
};
48+
plugins = [
49+
pkgs.espansoPlugins.dummy-package
50+
];
4851
} // espansoExtraArgs;
4952

5053
nmt.script = ''

0 commit comments

Comments
 (0)