1 { config, lib, pkgs, ... }:
6 cfg = config.services.navidrome;
7 settingsFormat = pkgs.formats.json {};
10 services.navidrome = {
12 enable = mkEnableOption (lib.mdDoc "Navidrome music server");
14 settings = mkOption rec {
15 type = settingsFormat.type;
16 apply = recursiveUpdate default;
18 Address = "127.0.0.1";
22 MusicFolder = "/mnt/music";
24 description = lib.mdDoc ''
25 Configuration for Navidrome, see <https://www.navidrome.org/docs/usage/configuration-options/> for supported values.
32 config = mkIf cfg.enable {
33 systemd.services.navidrome = {
34 description = "Navidrome Media Server";
35 after = [ "network.target" ];
36 wantedBy = [ "multi-user.target" ];
39 ${pkgs.navidrome}/bin/navidrome --configfile ${settingsFormat.generate "navidrome.json" cfg.settings}
42 StateDirectory = "navidrome";
43 WorkingDirectory = "/var/lib/navidrome";
44 RuntimeDirectory = "navidrome";
45 RootDirectory = "/run/navidrome";
48 # navidrome uses online services to download additional album metadata / covers
49 "${config.environment.etc."ssl/certs/ca-certificates.crt".source}:/etc/ssl/certs/ca-certificates.crt"
52 ] ++ lib.optional (cfg.settings ? MusicFolder) cfg.settings.MusicFolder;
53 CapabilityBoundingSet = "";
54 RestrictAddressFamilies = [ "AF_UNIX" "AF_INET" "AF_INET6" ];
55 RestrictNamespaces = true;
56 PrivateDevices = true;
59 ProtectControlGroups = true;
61 ProtectKernelLogs = true;
62 ProtectKernelModules = true;
63 ProtectKernelTunables = true;
64 SystemCallArchitectures = "native";
65 SystemCallFilter = [ "@system-service" "~@privileged" ];
66 RestrictRealtime = true;
67 LockPersonality = true;
68 MemoryDenyWriteExecute = true;
70 ProtectHostname = true;