diff options
author | nyanloutre <paul@nyanlout.re> | 2020-12-05 19:11:21 +0100 |
---|---|---|
committer | Jonathan Ringer <jonringer@users.noreply.github.com> | 2021-08-17 10:32:25 -0700 |
commit | c9fc751673898ee095d2c873c136e1a5505d5551 (patch) | |
tree | 13cad47e25180fe290fee195d7d600f43183c57d /nixos | |
parent | 945d0225b17a7f0919509be240fcce8427ebba13 (diff) |
nixos/navidrome: init module and test
Co-authored-by: aciceri <andrea.ciceri@autistici.org> Co-authored-by: nyanloutre <paul@nyanlout.re>
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/doc/manual/from_md/release-notes/rl-2111.section.xml | 10 | ||||
-rw-r--r-- | nixos/doc/manual/release-notes/rl-2111.section.md | 3 | ||||
-rw-r--r-- | nixos/modules/module-list.nix | 1 | ||||
-rw-r--r-- | nixos/modules/services/audio/navidrome.nix | 71 | ||||
-rw-r--r-- | nixos/tests/all-tests.nix | 1 | ||||
-rw-r--r-- | nixos/tests/navidrome.nix | 12 |
6 files changed, 98 insertions, 0 deletions
diff --git a/nixos/doc/manual/from_md/release-notes/rl-2111.section.xml b/nixos/doc/manual/from_md/release-notes/rl-2111.section.xml index 20c64f2a67106..2b1619cf3c9f1 100644 --- a/nixos/doc/manual/from_md/release-notes/rl-2111.section.xml +++ b/nixos/doc/manual/from_md/release-notes/rl-2111.section.xml @@ -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> diff --git a/nixos/doc/manual/release-notes/rl-2111.section.md b/nixos/doc/manual/release-notes/rl-2111.section.md index 87747e0fc1baa..40c286f69bc75 100644 --- a/nixos/doc/manual/release-notes/rl-2111.section.md +++ b/nixos/doc/manual/release-notes/rl-2111.section.md @@ -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 diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index 270e30704063b..7b638afc2070f 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -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 diff --git a/nixos/modules/services/audio/navidrome.nix b/nixos/modules/services/audio/navidrome.nix new file mode 100644 index 0000000000000..c2fe429f9844e --- /dev/null +++ b/nixos/modules/services/audio/navidrome.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; + }; + }; + }; +} diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index b1c3ccf782d14..c3dd50007aab6 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -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 {}; diff --git a/nixos/tests/navidrome.nix b/nixos/tests/navidrome.nix new file mode 100644 index 0000000000000..42e14720b2edf --- /dev/null +++ b/nixos/tests/navidrome.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") + ''; +}) |