1 { config, lib, pkgs, ... }:
7 cfg = config.services.serviio;
9 serviioStart = pkgs.writeScript "serviio.sh" ''
12 SERVIIO_HOME=${pkgs.serviio}
15 SERVIIO_CLASS_PATH="$SERVIIO_HOME/lib/*:$SERVIIO_HOME/config"
17 # Setup Serviio specific properties
18 JAVA_OPTS="-Djava.net.preferIPv4Stack=true -Djava.awt.headless=true -Dorg.restlet.engine.loggerFacadeClass=org.restlet.ext.slf4j.Slf4jLoggerFacade
19 -Dderby.system.home=${cfg.dataDir}/library -Dserviio.home=${cfg.dataDir} -Dffmpeg.location=${pkgs.ffmpeg}/bin/ffmpeg -Ddcraw.location=${pkgs.dcraw}/bin/dcraw"
21 # Execute the JVM in the foreground
22 exec ${pkgs.jre}/bin/java -Xmx512M -Xms20M -XX:+UseG1GC -XX:GCTimeRatio=1 -XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=20 $JAVA_OPTS -classpath "$SERVIIO_CLASS_PATH" org.serviio.MediaServer "$@"
35 Whether to enable the Serviio Media Server.
41 default = "/var/lib/serviio";
43 The directory where serviio stores its state, data, etc.
52 config = mkIf cfg.enable {
53 systemd.services.serviio = {
54 description = "Serviio Media Server";
55 after = [ "network.target" ];
56 wantedBy = [ "multi-user.target" ];
57 path = [ pkgs.serviio ];
61 ExecStart = "${serviioStart}";
62 ExecStop = "${serviioStart} -stop";
69 description = "Serviio Media Server User";
74 users.groups.serviio = { };
76 networking.firewall = {
78 8895 # serve UPnP responses
83 1900 # UPnP service discovery