2023-09-08 21:46:42 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
stdenv,
|
|
|
|
pkgs,
|
|
|
|
fetchFromGitHub,
|
|
|
|
runCommand,
|
|
|
|
buildNpmPackage,
|
|
|
|
nodejs_18,
|
|
|
|
tone,
|
|
|
|
ffmpeg-full,
|
|
|
|
util-linux,
|
|
|
|
python3,
|
|
|
|
getopt
|
|
|
|
}:
|
2023-01-29 01:20:37 +00:00
|
|
|
|
|
|
|
let
|
2023-05-10 10:44:11 +00:00
|
|
|
nodejs = nodejs_18;
|
2023-01-29 01:20:37 +00:00
|
|
|
|
|
|
|
pname = "audiobookshelf";
|
2023-09-20 13:49:08 +00:00
|
|
|
version = "2.4.3";
|
2023-01-29 01:20:37 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "advplyr";
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
2023-09-20 13:49:08 +00:00
|
|
|
sha256 = "sha256-Eqi6QVX8ZxX87IJcDNlDEzWYH7FBvYMs/iBAopLGYl4=";
|
2023-01-29 01:20:37 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
client = buildNpmPackage {
|
|
|
|
pname = "${pname}-client";
|
|
|
|
inherit version;
|
|
|
|
|
|
|
|
src = runCommand "cp-source" {} ''
|
|
|
|
cp -r ${src}/client $out
|
|
|
|
'';
|
|
|
|
|
|
|
|
NODE_OPTIONS = "--openssl-legacy-provider";
|
|
|
|
|
|
|
|
npmBuildScript = "generate";
|
2023-09-20 13:49:08 +00:00
|
|
|
npmDepsHash = "sha256-j6Q3i3ktvBUMQxCMNIqRjSMly6UMzewaF1EfAmNF8mQ=";
|
2023-01-29 01:20:37 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
wrapper = import ./wrapper.nix {
|
2023-09-08 21:46:42 +00:00
|
|
|
inherit stdenv ffmpeg-full tone pname nodejs getopt;
|
2023-01-29 01:20:37 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
in buildNpmPackage {
|
|
|
|
inherit pname version src;
|
|
|
|
|
|
|
|
buildInputs = [ util-linux ];
|
2023-07-14 14:24:38 +00:00
|
|
|
nativeBuildInputs = [ python3 ];
|
2023-01-29 01:20:37 +00:00
|
|
|
|
|
|
|
dontNpmBuild = true;
|
2023-04-18 17:14:03 +00:00
|
|
|
npmInstallFlags = [ "--only-production" ];
|
2023-09-20 13:49:08 +00:00
|
|
|
npmDepsHash = "sha256-fxXetf6KVK8hEwYZsER/rmt5tDagEOiyh+dJJE8FOXY=";
|
2023-01-29 01:20:37 +00:00
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/opt/client
|
|
|
|
cp -r index.js server package* node_modules $out/opt/
|
|
|
|
cp -r ${client}/lib/node_modules/${pname}-client/dist $out/opt/client/dist
|
|
|
|
mkdir $out/bin
|
|
|
|
|
|
|
|
echo '${wrapper}' > $out/bin/${pname}
|
|
|
|
echo " exec ${nodejs}/bin/node $out/opt/index.js" >> $out/bin/${pname}
|
|
|
|
|
|
|
|
chmod +x $out/bin/${pname}
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
homepage = "https://www.audiobookshelf.org/";
|
|
|
|
description = "Self-hosted audiobook and podcast server";
|
|
|
|
license = licenses.gpl3;
|
|
|
|
maintainers = [ maintainers.jvanbruegge ];
|
|
|
|
platforms = platforms.linux;
|
|
|
|
};
|
|
|
|
}
|