nixos/navidrome: init module and test

Co-authored-by: aciceri <andrea.ciceri@autistici.org>
Co-authored-by: nyanloutre <paul@nyanlout.re>
launchpad/nixpkgs/master
nyanloutre 4 years ago committed by Jonathan Ringer
parent 945d0225b1
commit c9fc751673
  1. 10
      nixos/doc/manual/from_md/release-notes/rl-2111.section.xml
  2. 3
      nixos/doc/manual/release-notes/rl-2111.section.md
  3. 1
      nixos/modules/module-list.nix
  4. 71
      nixos/modules/services/audio/navidrome.nix
  5. 1
      nixos/tests/all-tests.nix
  6. 12
      nixos/tests/navidrome.nix
  7. 4
      pkgs/servers/misc/navidrome/default.nix

@ -172,6 +172,16 @@
</para>
</listitem>
</itemizedlist>
<itemizedlist spacing="compact">
<listitem>
<para>
<link xlink:href="https://www.navidrome.org/">navidrome</link>,
a personal music streaming server with subsonic-compatible
api. Available as
<link linkend="opt-services.navidrome.enable">navidrome</link>.
</para>
</listitem>
</itemizedlist>
</section>
<section xml:id="sec-release-21.11-incompatibilities">
<title>Backward Incompatibilities</title>

@ -53,6 +53,9 @@ pt-services.clipcat.enable).
- [isso](https://posativ.org/isso/), a commenting server similar to Disqus.
Available as [isso](#opt-services.isso.enable)
* [navidrome](https://www.navidrome.org/), a personal music streaming server with
subsonic-compatible api. Available as [navidrome](#opt-services.navidrome.enable).
## Backward Incompatibilities {#sec-release-21.11-incompatibilities}
- The `staticjinja` package has been upgraded from 1.0.4 to 3.0.1

@ -254,6 +254,7 @@
./services/audio/mopidy.nix
./services/audio/networkaudiod.nix
./services/audio/roon-bridge.nix
./services/audio/navidrome.nix
./services/audio/roon-server.nix
./services/audio/slimserver.nix
./services/audio/snapserver.nix

@ -0,0 +1,71 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.navidrome;
settingsFormat = pkgs.formats.json {};
in {
options = {
services.navidrome = {
enable = mkEnableOption pkgs.navidrome.meta.description;
settings = mkOption rec {
type = settingsFormat.type;
apply = recursiveUpdate default;
default = {
Address = "127.0.0.1";
Port = 4533;
};
example = {
MusicFolder = "/mnt/music";
};
description = ''
Configuration for Navidrome, see <link xlink:href="https://www.navidrome.org/docs/usage/configuration-options/"/> for supported values.
'';
};
};
};
config = mkIf cfg.enable {
systemd.services.navidrome = {
description = "Navidrome Media Server";
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
serviceConfig = {
ExecStart = ''
${pkgs.navidrome}/bin/navidrome --configfile ${settingsFormat.generate "navidrome.json" cfg.settings}
'';
DynamicUser = true;
StateDirectory = "navidrome";
WorkingDirectory = "/var/lib/navidrome";
RuntimeDirectory = "navidrome";
RootDirectory = "/run/navidrome";
ReadWritePaths = "";
BindReadOnlyPaths = [
builtins.storeDir
] ++ lib.optional (cfg.settings ? MusicFolder) cfg.settings.MusicFolder;
CapabilityBoundingSet = "";
RestrictAddressFamilies = [ "AF_UNIX" "AF_INET" "AF_INET6" ];
RestrictNamespaces = true;
PrivateDevices = true;
PrivateUsers = true;
ProtectClock = true;
ProtectControlGroups = true;
ProtectHome = true;
ProtectKernelLogs = true;
ProtectKernelModules = true;
ProtectKernelTunables = true;
SystemCallArchitectures = "native";
SystemCallFilter = [ "@system-service" "~@privileged" "~@resources" ];
RestrictRealtime = true;
LockPersonality = true;
MemoryDenyWriteExecute = true;
UMask = "0066";
ProtectHostname = true;
};
};
};
}

@ -283,6 +283,7 @@ in
nat.firewall = handleTest ./nat.nix { withFirewall = true; };
nat.firewall-conntrack = handleTest ./nat.nix { withFirewall = true; withConntrackHelpers = true; };
nat.standalone = handleTest ./nat.nix { withFirewall = false; };
navidrome = handleTest ./navidrome.nix {};
ncdns = handleTest ./ncdns.nix {};
ndppd = handleTest ./ndppd.nix {};
nebula = handleTest ./nebula.nix {};

@ -0,0 +1,12 @@
import ./make-test-python.nix ({ pkgs, ... }: {
name = "navidrome";
machine = { ... }: {
services.navidrome.enable = true;
};
testScript = ''
machine.wait_for_unit("navidrome")
machine.wait_for_open_port("4533")
'';
})

@ -1,4 +1,4 @@
{ lib, stdenv, fetchurl, ffmpeg, ffmpegSupport ? true, makeWrapper }:
{ lib, stdenv, fetchurl, ffmpeg, ffmpegSupport ? true, makeWrapper, nixosTests }:
with lib;
@ -31,6 +31,8 @@ stdenv.mkDerivation rec {
--prefix PATH : ${makeBinPath (optional ffmpegSupport ffmpeg)}
'';
passthru.tests.navidrome = nixosTests.navidrome;
meta = {
description = "Navidrome Music Server and Streamer compatible with Subsonic/Airsonic";
homepage = "https://www.navidrome.org/";

Loading…
Cancel
Save