3
0
Fork 0
forked from mirrors/nixpkgs

nixos vdr: introduce option enableLirc

also introduce option socket for lirc, to have access to socket path
This commit is contained in:
Christian Kögler 2018-12-26 22:10:04 +01:00
parent 4543559aea
commit 987fdea1a8
2 changed files with 20 additions and 4 deletions

View file

@ -33,6 +33,13 @@ in {
description = "Extra arguments to lircd."; description = "Extra arguments to lircd.";
}; };
socket = mkOption {
type = types.path;
# default search path of many applications
default = "/run/lirc/lircd";
description = "Socket path";
};
}; };
}; };
@ -49,8 +56,7 @@ in {
description = "LIRC daemon socket"; description = "LIRC daemon socket";
wantedBy = [ "sockets.target" ]; wantedBy = [ "sockets.target" ];
socketConfig = { socketConfig = {
# default search path ListenStream = cfg.socket;
ListenStream = "/run/lirc/lircd";
SocketUser = "lirc"; SocketUser = "lirc";
SocketMode = "0660"; SocketMode = "0660";
}; };

View file

@ -33,12 +33,14 @@ in {
default = []; default = [];
description = "Additional command line arguments to pass to VDR."; description = "Additional command line arguments to pass to VDR.";
}; };
enableLirc = mkEnableOption "enable LIRC";
}; };
}; };
###### implementation ###### implementation
config = mkIf cfg.enable { config = mkIf cfg.enable (mkMerge [{
systemd.tmpfiles.rules = [ systemd.tmpfiles.rules = [
"d ${cfg.videoDir} 0755 vdr vdr -" "d ${cfg.videoDir} 0755 vdr vdr -"
"Z ${cfg.videoDir} - vdr vdr -" "Z ${cfg.videoDir} - vdr vdr -"
@ -67,5 +69,13 @@ in {
}; };
users.groups.vdr = {}; users.groups.vdr = {};
}; }
(mkIf cfg.enableLirc {
services.lirc.enable = true;
users.users.vdr.extraGroups = [ "lirc" ];
services.vdr.extraArguments = [
"--lirc=${config.services.lirc.socket}"
];
})]);
} }