From 987fdea1a8f8c0e1c0052646cfacf463e8a80e28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6gler?= Date: Wed, 26 Dec 2018 22:10:04 +0100 Subject: [PATCH] nixos vdr: introduce option enableLirc also introduce option socket for lirc, to have access to socket path --- nixos/modules/services/hardware/lirc.nix | 10 ++++++++-- nixos/modules/services/hardware/vdr.nix | 14 ++++++++++++-- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/nixos/modules/services/hardware/lirc.nix b/nixos/modules/services/hardware/lirc.nix index 0072406a438..ece38bd1e1c 100644 --- a/nixos/modules/services/hardware/lirc.nix +++ b/nixos/modules/services/hardware/lirc.nix @@ -33,6 +33,13 @@ in { 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"; wantedBy = [ "sockets.target" ]; socketConfig = { - # default search path - ListenStream = "/run/lirc/lircd"; + ListenStream = cfg.socket; SocketUser = "lirc"; SocketMode = "0660"; }; diff --git a/nixos/modules/services/hardware/vdr.nix b/nixos/modules/services/hardware/vdr.nix index 75136a2f796..695f0cbab1f 100644 --- a/nixos/modules/services/hardware/vdr.nix +++ b/nixos/modules/services/hardware/vdr.nix @@ -33,12 +33,14 @@ in { default = []; description = "Additional command line arguments to pass to VDR."; }; + + enableLirc = mkEnableOption "enable LIRC"; }; }; ###### implementation - config = mkIf cfg.enable { + config = mkIf cfg.enable (mkMerge [{ systemd.tmpfiles.rules = [ "d ${cfg.videoDir} 0755 vdr vdr -" "Z ${cfg.videoDir} - vdr vdr -" @@ -67,5 +69,13 @@ in { }; users.groups.vdr = {}; - }; + } + + (mkIf cfg.enableLirc { + services.lirc.enable = true; + users.users.vdr.extraGroups = [ "lirc" ]; + services.vdr.extraArguments = [ + "--lirc=${config.services.lirc.socket}" + ]; + })]); }