services: media: refactor logic

This makes it more DRY.
This commit is contained in:
Bruno BELANYI 2021-02-18 13:25:40 +00:00
parent b3aa8d94cb
commit 51491b99a9

View file

@ -2,8 +2,13 @@
{ config, lib, ... }: { config, lib, ... }:
let let
needed = with config.my.services; mediaServices = with config.my.services; [
jellyfin.enable || pirate.enable || sabnzbd.enable || transmission.enable; jellyfin
pirate
sabnzbd
transmission
];
needed = builtins.any (service: service.enable) mediaServices;
in in
{ {
config.users.groups.media = lib.mkIf needed { }; config.users.groups.media = lib.mkIf needed { };