8 cfg = config.services.brltty;
17 genApiKey = pkgs.writers.writeDash "generate-brlapi-key" ''
18 if ! test -f /etc/brlapi.key; then
19 echo -n generating brlapi key...
20 ${pkgs.brltty}/bin/brltty-genkey -f /etc/brlapi.key
30 services.brltty.enable = lib.mkOption {
31 type = lib.types.bool;
33 description = "Whether to enable the BRLTTY daemon.";
38 config = lib.mkIf cfg.enable {
39 users.users.brltty = {
40 description = "BRLTTY daemon user";
49 systemd.services."brltty@".serviceConfig = {
50 ExecStartPre = "!${genApiKey}";
53 # Install all upstream-provided files
54 systemd.packages = [ pkgs.brltty ];
55 systemd.tmpfiles.packages = [ pkgs.brltty ];
56 services.udev.packages = [ pkgs.brltty ];
57 environment.systemPackages = [ pkgs.brltty ];
59 # Add missing WantedBys (see issue #81138)
60 systemd.paths.brltty.wantedBy = targets;
61 systemd.paths."brltty@".wantedBy = targets;