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 1/2] 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}" + ]; + })]); } From 9b2f0fbcdd4cbb4acac3f894cb93d0efdd5fcd26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Sat, 5 Jan 2019 13:22:39 +0100 Subject: [PATCH 2/2] nixos/lirc: expose socket path via passthru --- nixos/modules/services/hardware/lirc.nix | 12 +++--------- nixos/modules/services/hardware/vdr.nix | 2 +- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/nixos/modules/services/hardware/lirc.nix b/nixos/modules/services/hardware/lirc.nix index ece38bd1e1c..826e512c75d 100644 --- a/nixos/modules/services/hardware/lirc.nix +++ b/nixos/modules/services/hardware/lirc.nix @@ -32,14 +32,6 @@ in { default = []; description = "Extra arguments to lircd."; }; - - socket = mkOption { - type = types.path; - # default search path of many applications - default = "/run/lirc/lircd"; - description = "Socket path"; - }; - }; }; @@ -50,13 +42,15 @@ in { # Note: LIRC executables raises a warning, if lirc_options.conf do not exists environment.etc."lirc/lirc_options.conf".text = cfg.options; + passthru.lirc.socket = "/run/lirc/lircd"; + environment.systemPackages = [ pkgs.lirc ]; systemd.sockets.lircd = { description = "LIRC daemon socket"; wantedBy = [ "sockets.target" ]; socketConfig = { - ListenStream = cfg.socket; + ListenStream = config.passthru.lirc.socket; SocketUser = "lirc"; SocketMode = "0660"; }; diff --git a/nixos/modules/services/hardware/vdr.nix b/nixos/modules/services/hardware/vdr.nix index 695f0cbab1f..4822506a899 100644 --- a/nixos/modules/services/hardware/vdr.nix +++ b/nixos/modules/services/hardware/vdr.nix @@ -75,7 +75,7 @@ in { services.lirc.enable = true; users.users.vdr.extraGroups = [ "lirc" ]; services.vdr.extraArguments = [ - "--lirc=${config.services.lirc.socket}" + "--lirc=${config.passthru.lirc.socket}" ]; })]); }