nixos/services.airsonic: remove with lib;
This commit is contained in:
@@ -1,7 +1,4 @@
|
||||
{ config, lib, options, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.services.airsonic;
|
||||
opt = options.services.airsonic;
|
||||
@@ -9,16 +6,16 @@ in {
|
||||
options = {
|
||||
|
||||
services.airsonic = {
|
||||
enable = mkEnableOption "Airsonic, the Free and Open Source media streaming server (fork of Subsonic and Libresonic)";
|
||||
enable = lib.mkEnableOption "Airsonic, the Free and Open Source media streaming server (fork of Subsonic and Libresonic)";
|
||||
|
||||
user = mkOption {
|
||||
type = types.str;
|
||||
user = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "airsonic";
|
||||
description = "User account under which airsonic runs.";
|
||||
};
|
||||
|
||||
home = mkOption {
|
||||
type = types.path;
|
||||
home = lib.mkOption {
|
||||
type = lib.types.path;
|
||||
default = "/var/lib/airsonic";
|
||||
description = ''
|
||||
The directory where Airsonic will create files.
|
||||
@@ -26,16 +23,16 @@ in {
|
||||
'';
|
||||
};
|
||||
|
||||
virtualHost = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
virtualHost = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.str;
|
||||
default = null;
|
||||
description = ''
|
||||
Name of the nginx virtualhost to use and setup. If null, do not setup any virtualhost.
|
||||
'';
|
||||
};
|
||||
|
||||
listenAddress = mkOption {
|
||||
type = types.str;
|
||||
listenAddress = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "127.0.0.1";
|
||||
description = ''
|
||||
The host name or IP address on which to bind Airsonic.
|
||||
@@ -47,8 +44,8 @@ in {
|
||||
'';
|
||||
};
|
||||
|
||||
port = mkOption {
|
||||
type = types.port;
|
||||
port = lib.mkOption {
|
||||
type = lib.types.port;
|
||||
default = 4040;
|
||||
description = ''
|
||||
The port on which Airsonic will listen for
|
||||
@@ -56,8 +53,8 @@ in {
|
||||
'';
|
||||
};
|
||||
|
||||
contextPath = mkOption {
|
||||
type = types.path;
|
||||
contextPath = lib.mkOption {
|
||||
type = lib.types.path;
|
||||
default = "/";
|
||||
description = ''
|
||||
The context path, i.e., the last part of the Airsonic
|
||||
@@ -65,8 +62,8 @@ in {
|
||||
'';
|
||||
};
|
||||
|
||||
maxMemory = mkOption {
|
||||
type = types.int;
|
||||
maxMemory = lib.mkOption {
|
||||
type = lib.types.int;
|
||||
default = 100;
|
||||
description = ''
|
||||
The memory limit (max Java heap size) in megabytes.
|
||||
@@ -74,10 +71,10 @@ in {
|
||||
'';
|
||||
};
|
||||
|
||||
transcoders = mkOption {
|
||||
type = types.listOf types.path;
|
||||
transcoders = lib.mkOption {
|
||||
type = lib.types.listOf lib.types.path;
|
||||
default = [ "${pkgs.ffmpeg.bin}/bin/ffmpeg" ];
|
||||
defaultText = literalExpression ''[ "''${pkgs.ffmpeg.bin}/bin/ffmpeg" ]'';
|
||||
defaultText = lib.literalExpression ''[ "''${pkgs.ffmpeg.bin}/bin/ffmpeg" ]'';
|
||||
description = ''
|
||||
List of paths to transcoder executables that should be accessible
|
||||
from Airsonic. Symlinks will be created to each executable inside
|
||||
@@ -85,7 +82,7 @@ in {
|
||||
'';
|
||||
};
|
||||
|
||||
jre = mkPackageOption pkgs "jre8" {
|
||||
jre = lib.mkPackageOption pkgs "jre8" {
|
||||
extraDescription = ''
|
||||
::: {.note}
|
||||
Airsonic only supports Java 8, airsonic-advanced requires at least
|
||||
@@ -94,14 +91,14 @@ in {
|
||||
'';
|
||||
};
|
||||
|
||||
war = mkOption {
|
||||
type = types.path;
|
||||
war = lib.mkOption {
|
||||
type = lib.types.path;
|
||||
default = "${pkgs.airsonic}/webapps/airsonic.war";
|
||||
defaultText = literalExpression ''"''${pkgs.airsonic}/webapps/airsonic.war"'';
|
||||
defaultText = lib.literalExpression ''"''${pkgs.airsonic}/webapps/airsonic.war"'';
|
||||
description = "Airsonic war file to use.";
|
||||
};
|
||||
|
||||
jvmOptions = mkOption {
|
||||
jvmOptions = lib.mkOption {
|
||||
description = ''
|
||||
Extra command line options for the JVM running AirSonic.
|
||||
Useful for sending jukebox output to non-default alsa
|
||||
@@ -109,7 +106,7 @@ in {
|
||||
'';
|
||||
default = [
|
||||
];
|
||||
type = types.listOf types.str;
|
||||
type = lib.types.listOf lib.types.str;
|
||||
example = [
|
||||
"-Djavax.sound.sampled.Clip='#CODEC [plughw:1,0]'"
|
||||
"-Djavax.sound.sampled.Port='#Port CODEC [hw:1]'"
|
||||
@@ -121,7 +118,7 @@ in {
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
config = lib.mkIf cfg.enable {
|
||||
systemd.services.airsonic = {
|
||||
description = "Airsonic Media Server";
|
||||
after = [ "network.target" ];
|
||||
@@ -143,7 +140,7 @@ in {
|
||||
-Dserver.port=${toString cfg.port} \
|
||||
-Dserver.context-path=${cfg.contextPath} \
|
||||
-Djava.awt.headless=true \
|
||||
${optionalString (cfg.virtualHost != null)
|
||||
${lib.optionalString (cfg.virtualHost != null)
|
||||
"-Dserver.use-forward-headers=true"} \
|
||||
${toString cfg.jvmOptions} \
|
||||
-verbose:gc \
|
||||
@@ -155,7 +152,7 @@ in {
|
||||
};
|
||||
};
|
||||
|
||||
services.nginx = mkIf (cfg.virtualHost != null) {
|
||||
services.nginx = lib.mkIf (cfg.virtualHost != null) {
|
||||
enable = true;
|
||||
recommendedProxySettings = true;
|
||||
virtualHosts.${cfg.virtualHost} = {
|
||||
|
||||
Reference in New Issue
Block a user