1 { lib, stdenv, fetchurl, pkg-config, python3, bluez
2 , tcl, acl, kmod, coreutils, shadow, util-linux
3 , alsaSupport ? stdenv.hostPlatform.isLinux, alsa-lib
4 , systemdSupport ? lib.meta.availableOn stdenv.hostPlatform systemd, systemd
7 stdenv.mkDerivation rec {
12 url = "https://brltty.app/archive/brltty-${version}.tar.gz";
13 sha256 = "E+j2mb8UTuGx6PkAOt03hQkvf1XvEHxJEuPBT2zMpPw=";
16 nativeBuildInputs = [ pkg-config python3.pkgs.cython python3.pkgs.setuptools tcl ];
17 buildInputs = [ bluez ]
18 ++ lib.optional alsaSupport alsa-lib
19 ++ lib.optional systemdSupport systemd;
22 description = "Access software for a blind person using a braille display";
24 BRLTTY is a background process (daemon) which provides access to the Linux/Unix
25 console (when in text mode) for a blind person using a refreshable braille display.
26 It drives the braille display, and provides complete screen review functionality.
27 Some speech capability has also been incorporated.
29 homepage = "https://brltty.app";
30 license = lib.licenses.gpl2Plus;
31 maintainers = [ lib.maintainers.bramd ];
32 platforms = lib.platforms.all;
36 "PYTHON_PREFIX=$(out)"
37 "SYSTEMD_UNITS_DIRECTORY=$(out)/lib/systemd/system"
38 "SYSTEMD_USERS_DIRECTORY=$(out)/lib/sysusers.d"
39 "SYSTEMD_FILES_DIRECTORY=$(out)/lib/tmpfiles.d"
40 "UDEV_PARENT_LOCATION=$(out)/lib"
41 "INSTALL_COMMANDS_DIRECTORY=$(out)/libexec/brltty"
43 "POLKIT_POLICY_DIR=$(out)/share/polkit-1/actions"
44 "POLKIT_RULE_DIR=$(out)/share/polkit-1/rules.d"
48 "--with-writable-directory=/run/brltty"
49 "--with-updatable-directory=/var/lib/brltty"
50 "--with-api-socket-path=/var/lib/BrlAPI"
52 installFlags = [ "install-systemd" "install-udev" "install-polkit" ];
55 substituteInPlace configure --replace /sbin/ldconfig ldconfig
57 # Some script needs a working tclsh shebang
60 # Skip impure operations
61 substituteInPlace Programs/Makefile.in \
62 --replace install-writable-directory "" \
63 --replace install-apisoc-directory "" \
64 --replace install-api-key ""
68 # Rewrite absolute paths
69 substituteInPlace $out/bin/brltty-mkuser \
70 --replace '/sbin/nologin' '${shadow}/bin/nologin'
73 substituteInPlace systemd/system/brltty@.service \
74 --replace '/sbin/modprobe' '${kmod}/bin/modprobe'
75 # Ensure the systemd-wrapper script uses the correct path to the brltty binary
76 sed "/^Environment=\"BRLTTY_EXECUTABLE_ARGUMENTS.*/a Environment=\"BRLTTY_EXECUTABLE_PATH=$out/bin/brltty\"" -i systemd/system/brltty@.service
77 substituteInPlace systemd/system/brltty-device@.service \
78 --replace '/usr/bin/true' '${coreutils}/bin/true'
79 substituteInPlace udev/rules.d/90-brltty-uinput.rules \
80 --replace '/usr/bin/setfacl' '${acl}/bin/setfacl'
81 substituteInPlace udev/rules.d/90-brltty-hid.rules \
82 --replace '/usr/bin/setfacl' '${acl}/bin/setfacl'
83 substituteInPlace tmpfiles.d/brltty.conf \
84 --replace "$out/etc" '/etc'
86 # Remove unused commands from udev rules
87 sed '/initctl/d' -i udev/rules.d/90-brltty-usb-generic.rules
88 sed '/initctl/d' -i udev/rules.d/90-brltty-usb-customized.rules
89 # Remove pulse-access group from systemd unit and sysusers
90 substituteInPlace systemd/system/brltty@.service \
91 --replace 'SupplementaryGroups=pulse-access' '# SupplementaryGroups=pulse-access'
92 substituteInPlace sysusers.d/brltty.conf \
93 --replace 'm brltty pulse-access' '# m brltty pulse-access'
95 substituteInPlace $out/libexec/brltty/systemd-wrapper \
96 --replace 'logger' "${util-linux}/bin/logger" \
97 --replace 'udevadm' "${systemd}/bin/udevadm"