1 { config, lib, pkgs, ... }:
6 cfg = config.services.brltty;
9 "default.target" "multi-user.target"
10 "rescue.target" "emergency.target"
13 genApiKey = pkgs.writers.writeDash "generate-brlapi-key" ''
14 if ! test -f /etc/brlapi.key; then
15 echo -n generating brlapi key...
16 ${pkgs.brltty}/bin/brltty-genkey -f /etc/brlapi.key
25 services.brltty.enable = mkOption {
28 description = lib.mdDoc "Whether to enable the BRLTTY daemon.";
33 config = mkIf cfg.enable {
34 users.users.brltty = {
35 description = "BRLTTY daemon user";
43 systemd.services."brltty@".serviceConfig =
44 { ExecStartPre = "!${genApiKey}"; };
46 # Install all upstream-provided files
47 systemd.packages = [ pkgs.brltty ];
48 systemd.tmpfiles.packages = [ pkgs.brltty ];
49 services.udev.packages = [ pkgs.brltty ];
50 environment.systemPackages = [ pkgs.brltty ];
52 # Add missing WantedBys (see issue #81138)
53 systemd.paths.brltty.wantedBy = targets;
54 systemd.paths."brltty@".wantedBy = targets;