nixos lirc: fix owner-ship of runtime directory

This commit is contained in:
Christian Kögler 2018-12-08 14:35:07 +01:00
parent ca3f089a83
commit 4bb55815be

View File

@ -49,6 +49,7 @@ in {
description = "LIRC daemon socket";
wantedBy = [ "sockets.target" ];
socketConfig = {
# default search path
ListenStream = "/run/lirc/lircd";
SocketUser = "lirc";
SocketMode = "0660";
@ -66,9 +67,19 @@ in {
serviceConfig = {
RuntimeDirectory = "lirc";
# socket lives in runtime directory; we have to keep is available
# Service runtime directory and socket share same folder.
# Following hacks are necessary to get everything right:
# 1. prevent socket deletion during stop and restart
RuntimeDirectoryPreserve = true;
# 2. fix runtime folder owner-ship, happens when socket activation
# creates the folder
PermissionsStartOnly = true;
ExecStartPre = [
"${pkgs.coreutils}/bin/chown lirc /run/lirc/"
];
ExecStart = ''
${pkgs.lirc}/bin/lircd --nodaemon \
${escapeShellArgs cfg.extraArguments} \