[BRLTTY] BRLTTY Nix package

Didier Spaier didier at slint.fr
Thu May 7 09:01:08 EDT 2015



On 07/05/2015 14:27, Bram Duvigneau wrote:
> On 5/7/2015 12:30 AM, Didier Spaier wrote:
>>
>>
>> On 07/05/2015 00:19, Bram Duvigneau wrote:
>>> Mario Lang schreef op 7-5-2015 om 00:11:
>>>> Bram Duvigneau <bram at bramd.nl> writes:
>>>>
>>>>> to give the package a try, it should be available in the NixOS
>>>>> unstable
>>>>> channel and will be included in the next stable release.
>>>> Mind sharing the git repo and relevant paths?  I'd like to look at the
>>>> package definition.
>>>>
>>> Of course, any feedback is welcome.
>>>
>>> Package definition:
>>> https://github.com/NixOS/nixpkgs/blob/master/pkgs/tools/misc/brltty/default.nix
>>>
>>>
>>> NixOS module/service definition:
>>> https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/services/hardware/brltty.nix
>>>
>>
>> How would that work (especially the module/service definition) on a
>> system that doesn't ship systemd? I have Slackware in mind.
> The service module is specifically for NixOS, which is using systemd. If
> you would use just Nix on another platform to install packages, you
> would have to either start BRLTTY manually or write your own
> init/wrapper script. The Nix definitions allow for conditionals for
> specific platforms, see the ALSA flag in BRLTTy for an example. So you
> might be able to do something with that. That being said, I only have
> used NixOS so far and don't know much of Nix on other platforms.
> Furthermore, it does not integrate with native package managers of other
> platforms, but keeps a separate package tree, si it's not meant to
> generate native packages if that was your understanding.
>
> I'm currently using NixOS for a development machine where I can easily
> build different development configurations and dependencies for various
> projects.
>
> Bram

Thanks for clarifying.

FWIW, I attach the init/wrapper script I wrote for Slint/Slackware.

The init script /etc/rc.d/rc.S runs "/etc/rc.d/rc.brltty start"
just after modules loading, if rc.brltty is executable.

Didier
-------------- next part --------------
#!/bin/sh
#
# Start/stop brltty
#
brltty_start() {
  if [ ! "`ps -C brltty --noheaders|wc -l`" = "0" ]; then
    echo "brltty is already started."
    brltty_status
    exit
  fi
  if [ -x /bin/brltty ]; then
    echo "Starting brltty daemon: /bin/brltty "
    /bin/brltty
  fi
}
brltty_stop() {
  NBPROC="`ps -C brltty --noheaders|wc -l`"
  if [  "$NBPROC" = "1" ]; then
    echo "Stopping brltty..."
    PID="`ps -C brltty --noheaders -o pid`"
    kill $PID
  elif [ "$NBPROC" = "0" ]; then    
    echo "brltty is not started."
  else
    echo "I can't stop brltty, several daemons are running:"
    brltty_status
  fi
}
brltty_status () {
  NBPROC="`ps -C brltty --noheaders|wc -l`"
  if [ "$NBPROC" = "0" ]; then
    echo "No active brltty daemon." 
  elif [ "$NBPROC" = "1" ]; then
    echo "A brltty daemon is running, PID: `ps -C brltty --no-headers -o pid`"
  else
    ps -C brltty -o pid,args
fi
}
case "$1" in
'start')
  brltty_start
  ;;
'stop')
  brltty_stop
  ;;
'restart')
  brltty_stop
  sleep 3
  brltty_start
  ;;
'status')
  brltty_status
  ;;
*)
  echo "usage $0 restart|start|status|stop|"
esac 


More information about the BRLTTY mailing list