From 51491b99a93a64b29152b8bb06c3bd168dfddfaf Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Thu, 18 Feb 2021 13:25:40 +0000 Subject: [PATCH] services: media: refactor logic This makes it more DRY. --- services/media.nix | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/services/media.nix b/services/media.nix index fc6a8b1..e55ac89 100644 --- a/services/media.nix +++ b/services/media.nix @@ -2,8 +2,13 @@ { config, lib, ... }: let - needed = with config.my.services; - jellyfin.enable || pirate.enable || sabnzbd.enable || transmission.enable; + mediaServices = with config.my.services; [ + jellyfin + pirate + sabnzbd + transmission + ]; + needed = builtins.any (service: service.enable) mediaServices; in { config.users.groups.media = lib.mkIf needed { };