Repository navigation
Expand file tree
/
Copy pathmodule.nix
More file actions
56 lines (51 loc) · 1.59 KB
/
Copy pathmodule.nix
File metadata and controls
56 lines (51 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# NixOS module for OpenWhispr.
#
# Installs the app and configures everything Wayland auto-paste needs, which is
# the main pain point for Nix users (see issue #728): ydotool, the uinput kernel
# module + udev rule, and the group memberships that let a user reach both.
#
# Example:
# programs.openwhispr = {
# enable = true;
# users = [ "alice" ];
# };
self:
{
config,
lib,
pkgs,
...
}:
let
cfg = config.programs.openwhispr;
in
{
options.programs.openwhispr = {
enable = lib.mkEnableOption "OpenWhispr voice dictation app with Wayland auto-paste support";
users = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [ ];
example = [ "alice" ];
description = ''
Users to grant Wayland auto-paste access. Each listed user is added to the
ydotool group (to reach the ydotoold socket) and the uinput group (OpenWhispr's
own linux-fast-paste backend opens /dev/uinput directly). Leave empty to manage
group membership yourself.
'';
};
};
config = lib.mkIf cfg.enable {
environment.systemPackages = [ self.packages.${pkgs.system}.default ];
# ydotoold daemon + ydotool group + socket for Wayland keystroke injection.
programs.ydotool.enable = true;
# Load the uinput module and install its udev rule. programs.ydotool does not
# do this, and OpenWhispr's linux-fast-paste --uinput needs /dev/uinput directly.
hardware.uinput.enable = true;
users.users = lib.genAttrs cfg.users (_: {
extraGroups = [
config.programs.ydotool.group
"uinput"
];
});
};
}