From 18acb80b82a3609637e90fbc071b569a999c9b8a Mon Sep 17 00:00:00 2001 From: Bram Duvigneau Date: Wed, 9 Sep 2015 11:51:22 +0200 Subject: [PATCH] Brltty service: simplified systemd service definition, now it matches the variant that has been developed upstream. Now the BRLTTY service comes up reliably on boot. --- nixos/modules/services/hardware/brltty.nix | 28 +++++++++++++--------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/nixos/modules/services/hardware/brltty.nix b/nixos/modules/services/hardware/brltty.nix index d6c05a3d620c..03e530b2c96d 100644 --- a/nixos/modules/services/hardware/brltty.nix +++ b/nixos/modules/services/hardware/brltty.nix @@ -4,10 +4,6 @@ with lib; let cfg = config.services.brltty; - - stateDir = "/run/brltty"; - - pidFile = "${stateDir}/brltty.pid"; in { @@ -24,14 +20,24 @@ in { config = mkIf cfg.enable { systemd.services.brltty = { - description = "Braille console driver"; - preStart = '' - mkdir -p ${stateDir} - ''; + description = "Braille Device Support"; + unitConfig = { + Documentation = "http://mielke.cc/brltty/"; + DefaultDependencies = "no"; + RequiresMountsFor = "${pkgs.brltty}/var/lib/brltty"; + }; serviceConfig = { - ExecStart = "${pkgs.brltty}/bin/brltty --pid-file=${pidFile}"; - Type = "forking"; - PIDFile = pidFile; + ExecStart = "${pkgs.brltty}/bin/brltty --no-daemon"; + Type = "simple"; # Change to notidy after next releae + TimeoutStartSec = 5; + TimeoutStopSec = 10; + Restart = "always"; + RestartSec = 30; + Nice = -10; + OOMScoreAdjust = -900; + ProtectHome = "read-only"; + ProtectSystem = "full"; + SystemCallArchitectures = "native"; }; before = [ "sysinit.target" ]; wantedBy = [ "sysinit.target" ];