parent
74f4e7289b
commit
41ce21aae4
|
@ -14,8 +14,6 @@ in rec {
|
|||
|
||||
} // optionalAttrs (pkgs.system == "x86_64-linux") rec {
|
||||
|
||||
navidrome-bin = callPackage ./pkgs/navidrome-bin { };
|
||||
|
||||
ryzen_smu = callPackage ./pkgs/ryzen_smu { kernel = pkgs.linux; };
|
||||
|
||||
} // optionalAttrs (builtins.elem pkgs.system pkgs.lib.platforms.linux) rec {
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
nixosModules = {
|
||||
ryzenSMU = import ./modules/ryzenSMU;
|
||||
|
||||
servicesNavidrome = import ./modules/services/navidrome.nix;
|
||||
servicesSnipeIT = import ./modules/services/snipe-it.nix;
|
||||
};
|
||||
|
||||
|
@ -38,7 +37,6 @@
|
|||
;
|
||||
} // prev.lib.optionalAttrs (prev.system == "x86_64-linux") rec {
|
||||
inherit (localPkgs)
|
||||
navidrome-bin
|
||||
ryzen_smu
|
||||
;
|
||||
} // prev.lib.optionalAttrs (builtins.elem prev.system prev.lib.platforms.linux) rec {
|
||||
|
|
|
@ -1,82 +0,0 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
inherit (lib) callPackageWith mkEnableOption mkIf mkOption
|
||||
recursiveUpdate types;
|
||||
|
||||
cfg = config.services.navidrome;
|
||||
package = callPackageWith pkgs ../../pkgs/navidrome-bin { };
|
||||
settingsFormat = pkgs.formats.json {};
|
||||
|
||||
in lib.optionalAttrs (lib.versionOlder lib.version "21.11pre") {
|
||||
|
||||
options = {
|
||||
services.navidrome = {
|
||||
|
||||
enable = mkEnableOption package.meta.description;
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
default = package;
|
||||
description = "Navidrome package to use.";
|
||||
};
|
||||
|
||||
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 = ''
|
||||
${cfg.package}/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;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
}
|
|
@ -1,49 +0,0 @@
|
|||
{ lib, stdenv, pkgs, fetchurl, ffmpeg, ffmpegSupport ? true, makeWrapper, nixosTests }:
|
||||
|
||||
with lib;
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "navidrome-bin";
|
||||
version = "0.46.0";
|
||||
|
||||
|
||||
src = fetchurl (if pkgs.system == "x86_64-linux"
|
||||
then {
|
||||
url = "https://github.com/navidrome/navidrome/releases/download/v${version}/navidrome_${version}_Linux_x86_64.tar.gz";
|
||||
sha256 = "sha256-baBSQZnlcC5zq7wKWbia8xEMqZuCgkn/zyQWwtfHn/w=";
|
||||
}
|
||||
else {
|
||||
url = "https://github.com/navidrome/navidrome/releases/download/v${version}/navidrome_${version}_Linux_arm64.tar.gz";
|
||||
sha256 = "sha256-Km58BMc2ngv6CLqXkNpDIxC+nFb/fbvz7iBF0/xNcsU=";
|
||||
});
|
||||
|
||||
nativeBuildInputs = [ makeWrapper ];
|
||||
|
||||
unpackPhase = ''
|
||||
tar xvf $src navidrome
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
mkdir -p $out/bin
|
||||
cp navidrome $out/bin
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
postFixup = ''
|
||||
wrapProgram $out/bin/navidrome \
|
||||
--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/";
|
||||
license = licenses.gpl3Only;
|
||||
platforms = [ "x86_64-linux" "aarch64-linux" ];
|
||||
maintainers = with maintainers; [ aciceri ];
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue