config/modules/services/minidlna/default.nix

33 lines
697 B
Nix
Raw Permalink Normal View History

2024-08-03 07:03:15 +03:00
{ config, lib, ... }:
let
cfg = config.mj.services.minidlna;
in
{
options.mj.services.minidlna = with lib.types; {
enable = lib.mkEnableOption "Enable minidlna";
paths = lib.mkOption { type = listOf path; };
};
2024-08-03 12:12:27 +03:00
config = lib.mkIf cfg.enable {
2024-08-03 07:03:15 +03:00
services.minidlna = {
enable = true;
openFirewall = true;
settings = {
media_dir = cfg.paths;
friendly_name = "${config.networking.hostName}.${config.networking.domain}";
inotify = "yes";
};
};
systemd.services.minidlna = {
serviceConfig = {
ProtectSystem = "strict";
ProtectHome = "tmpfs";
BindReadOnlyPaths = cfg.paths;
};
};
};
}