1 { config, lib, pkgs, ... }:
3 cfg = config.services.brltty;
6 "default.target" "multi-user.target"
7 "rescue.target" "emergency.target"
10 genApiKey = pkgs.writers.writeDash "generate-brlapi-key" ''
11 if ! test -f /etc/brlapi.key; then
12 echo -n generating brlapi key...
13 ${pkgs.brltty}/bin/brltty-genkey -f /etc/brlapi.key
22 services.brltty.enable = lib.mkOption {
23 type = lib.types.bool;
25 description = "Whether to enable the BRLTTY daemon.";
30 config = lib.mkIf cfg.enable {
31 users.users.brltty = {
32 description = "BRLTTY daemon user";
41 systemd.services."brltty@".serviceConfig =
42 { ExecStartPre = "!${genApiKey}"; };
44 # Install all upstream-provided files
45 systemd.packages = [ pkgs.brltty ];
46 systemd.tmpfiles.packages = [ pkgs.brltty ];
47 services.udev.packages = [ pkgs.brltty ];
48 environment.systemPackages = [ pkgs.brltty ];
50 # Add missing WantedBys (see issue #81138)
51 systemd.paths.brltty.wantedBy = targets;
52 systemd.paths."brltty@".wantedBy = targets;