From 1db9813dd3ccb9d5aa05c61c9fb3bc5b1ab73c7c Mon Sep 17 00:00:00 2001 From: "Antoine R. Dumont (@ardumont)" Date: Sat, 18 Jul 2020 10:05:15 +0200 Subject: [PATCH] mediatomb/gerbera: Make transcoding option lazy and runnable if activated In the sense that the pkgs dependency will be pulled if the service is transcoding enabled. Otherwise, the transcoding part is completely dropped from the generated configuration. --- nixos/modules/services/misc/mediatomb.nix | 62 +++++++++++++---------- 1 file changed, 34 insertions(+), 28 deletions(-) diff --git a/nixos/modules/services/misc/mediatomb.nix b/nixos/modules/services/misc/mediatomb.nix index ba2bbfbc221..bc7d1545829 100644 --- a/nixos/modules/services/misc/mediatomb.nix +++ b/nixos/modules/services/misc/mediatomb.nix @@ -9,6 +9,38 @@ let name = cfg.package.pname; pkg = cfg.package; optionYesNo = option: if option then "yes" else "no"; + transcodingConfig = if cfg.transcoding then with pkgs; '' + + + + + + + + + + audio/mpeg + no + yes + no + + + + + video/mpeg + yes + yes + yes + + + + + +'' else '' + + +''; mtConf = pkgs.writeText "config.xml" '' @@ -121,38 +153,12 @@ let - - - - - - - - - - audio/L16 - no - yes - no - - - - - video/mpeg - yes - yes - yes - - - - - + ${transcodingConfig} - ''; +''; in { - ###### interface options = {