1{ config, lib, pkgs, ... }:
2
3with lib;
4
5let
6 cfg = config.services.brltty;
7
8 stateDir = "/run/brltty";
9
10 pidFile = "${stateDir}/brltty.pid";
11
12in {
13
14 options = {
15
16 services.brltty.enable = mkOption {
17 type = types.bool;
18 default = false;
19 description = "Whether to enable the BRLTTY daemon.";
20 };
21
22 };
23
24 config = mkIf cfg.enable {
25
26 systemd.services.brltty = {
27 description = "Braille console driver";
28 preStart = ''
29 mkdir -p ${stateDir}
30 '';
31 serviceConfig = {
32 ExecStart = "${pkgs.brltty}/bin/brltty --pid-file=${pidFile}";
33 Type = "forking";
34 PIDFile = pidFile;
35 };
36 before = [ "sysinit.target" ];
37 wantedBy = [ "sysinit.target" ];
38 };
39
40 };
41
42}