Merge pull request #52943 from ck3d/vdr-enableLirc

nixos vdr: introduce option enableLirc
This commit is contained in:
Jörg Thalheim 2019-01-05 17:51:41 +01:00 committed by GitHub
commit 09fb07e4af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 5 deletions

View File

@ -32,7 +32,6 @@ in {
default = []; default = [];
description = "Extra arguments to lircd."; description = "Extra arguments to lircd.";
}; };
}; };
}; };
@ -43,14 +42,15 @@ in {
# Note: LIRC executables raises a warning, if lirc_options.conf do not exists # Note: LIRC executables raises a warning, if lirc_options.conf do not exists
environment.etc."lirc/lirc_options.conf".text = cfg.options; environment.etc."lirc/lirc_options.conf".text = cfg.options;
passthru.lirc.socket = "/run/lirc/lircd";
environment.systemPackages = [ pkgs.lirc ]; environment.systemPackages = [ pkgs.lirc ];
systemd.sockets.lircd = { systemd.sockets.lircd = {
description = "LIRC daemon socket"; description = "LIRC daemon socket";
wantedBy = [ "sockets.target" ]; wantedBy = [ "sockets.target" ];
socketConfig = { socketConfig = {
# default search path ListenStream = config.passthru.lirc.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.passthru.lirc.socket}"
];
})]);
} }