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, ... }:
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 { };