2023-09-09 07:46:42 +10:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
stdenv,
|
|
|
|
fetchFromGitHub,
|
|
|
|
runCommand,
|
|
|
|
buildNpmPackage,
|
2025-03-21 09:39:24 -04:00
|
|
|
nodejs,
|
2023-09-09 07:46:42 +10:00
|
|
|
ffmpeg-full,
|
2024-10-14 12:51:55 +00:00
|
|
|
nunicode,
|
2023-09-09 07:46:42 +10:00
|
|
|
util-linux,
|
|
|
|
python3,
|
2024-08-10 14:07:26 +00:00
|
|
|
getopt,
|
|
|
|
nixosTests,
|
2023-09-09 07:46:42 +10:00
|
|
|
}:
|
2023-01-29 01:20:37 +00:00
|
|
|
|
|
|
|
let
|
2025-08-04 10:01:44 -04:00
|
|
|
source = {
|
2025-08-12 08:51:33 -04:00
|
|
|
version = "2.28.0";
|
|
|
|
hash = "sha256-bbsiaSGIaD5oFnhk3e+SWzYxv4dsRXrgMVbe1lsj4pw=";
|
|
|
|
npmDepsHash = "sha256-JC2uOXV+EwS6CGwyOUTXcymFwLSz/KUqIoB4ccSGgbw=";
|
|
|
|
clientNpmDepsHash = "sha256-6l8apOd3R259+SlcD6P6rx1FkRnB80keoBGcfbQNhGU=";
|
2025-08-04 10:01:44 -04:00
|
|
|
};
|
2023-01-29 01:20:37 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "advplyr";
|
2024-08-21 00:56:55 +02:00
|
|
|
repo = "audiobookshelf";
|
2025-01-03 21:24:13 +01:00
|
|
|
tag = "v${source.version}";
|
2024-01-18 14:17:33 -05:00
|
|
|
inherit (source) hash;
|
2023-01-29 01:20:37 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
client = buildNpmPackage {
|
2024-08-21 00:56:55 +02:00
|
|
|
pname = "audiobookshelf-client";
|
2024-01-18 14:17:33 -05:00
|
|
|
inherit (source) version;
|
2023-01-29 01:20:37 +00:00
|
|
|
|
2024-08-10 14:07:26 +00:00
|
|
|
src = runCommand "cp-source" { } ''
|
2023-01-29 01:20:37 +00:00
|
|
|
cp -r ${src}/client $out
|
|
|
|
'';
|
|
|
|
|
2024-05-29 12:54:48 +02:00
|
|
|
# don't download the Cypress binary
|
|
|
|
CYPRESS_INSTALL_BINARY = 0;
|
2023-01-29 01:20:37 +00:00
|
|
|
NODE_OPTIONS = "--openssl-legacy-provider";
|
|
|
|
|
|
|
|
npmBuildScript = "generate";
|
2025-08-04 10:01:44 -04:00
|
|
|
npmDepsHash = source.clientNpmDepsHash;
|
2023-01-29 01:20:37 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
wrapper = import ./wrapper.nix {
|
2024-08-10 14:07:26 +00:00
|
|
|
inherit
|
|
|
|
stdenv
|
|
|
|
ffmpeg-full
|
2024-10-14 12:51:55 +00:00
|
|
|
nunicode
|
2024-08-10 14:07:26 +00:00
|
|
|
getopt
|
|
|
|
;
|
2023-01-29 01:20:37 +00:00
|
|
|
};
|
|
|
|
|
2024-08-10 14:07:26 +00:00
|
|
|
in
|
|
|
|
buildNpmPackage {
|
2025-08-04 10:01:44 -04:00
|
|
|
pname = "audiobookshelf";
|
|
|
|
|
|
|
|
inherit src;
|
|
|
|
inherit (source) npmDepsHash version;
|
2023-01-29 01:20:37 +00:00
|
|
|
|
|
|
|
buildInputs = [ util-linux ];
|
2023-07-14 15:24:38 +01:00
|
|
|
nativeBuildInputs = [ python3 ];
|
2023-01-29 01:20:37 +00:00
|
|
|
|
|
|
|
dontNpmBuild = true;
|
2023-04-18 20:14:03 +03:00
|
|
|
npmInstallFlags = [ "--only-production" ];
|
2023-01-29 01:20:37 +00:00
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/opt/client
|
|
|
|
cp -r index.js server package* node_modules $out/opt/
|
2024-08-21 00:56:55 +02:00
|
|
|
cp -r ${client}/lib/node_modules/audiobookshelf-client/dist $out/opt/client/dist
|
2023-01-29 01:20:37 +00:00
|
|
|
mkdir $out/bin
|
|
|
|
|
2024-08-21 00:56:55 +02:00
|
|
|
echo '${wrapper}' > $out/bin/audiobookshelf
|
|
|
|
echo " exec ${nodejs}/bin/node $out/opt/index.js" >> $out/bin/audiobookshelf
|
2023-01-29 01:20:37 +00:00
|
|
|
|
2024-08-21 00:56:55 +02:00
|
|
|
chmod +x $out/bin/audiobookshelf
|
2023-01-29 01:20:37 +00:00
|
|
|
'';
|
|
|
|
|
2024-08-10 14:07:26 +00:00
|
|
|
passthru = {
|
|
|
|
tests.basic = nixosTests.audiobookshelf;
|
2025-08-04 10:01:44 -04:00
|
|
|
updateScript = ./update.sh;
|
2024-08-10 14:07:26 +00:00
|
|
|
};
|
2024-01-18 14:17:33 -05:00
|
|
|
|
2024-08-10 14:07:26 +00:00
|
|
|
meta = {
|
2023-01-29 01:20:37 +00:00
|
|
|
homepage = "https://www.audiobookshelf.org/";
|
|
|
|
description = "Self-hosted audiobook and podcast server";
|
2024-01-18 14:17:33 -05:00
|
|
|
changelog = "https://github.com/advplyr/audiobookshelf/releases/tag/v${source.version}";
|
2024-08-10 14:07:26 +00:00
|
|
|
license = lib.licenses.gpl3;
|
|
|
|
maintainers = with lib.maintainers; [
|
|
|
|
jvanbruegge
|
|
|
|
adamcstephens
|
2025-07-22 11:59:50 -04:00
|
|
|
tebriel
|
2024-08-10 14:07:26 +00:00
|
|
|
];
|
|
|
|
platforms = lib.platforms.linux;
|
2023-11-23 22:09:35 +01:00
|
|
|
mainProgram = "audiobookshelf";
|
2023-01-29 01:20:37 +00:00
|
|
|
};
|
|
|
|
}
|