audiobookshelf: skip version checks

Make sure no external dependencies are downloaded, since we provide our own binaries.
Add nixos test as package test.
This commit is contained in:
Martin Joerg 2024-08-10 14:07:26 +00:00
parent b14750bb61
commit 4f3cf967e3

View File

@ -8,7 +8,8 @@
ffmpeg-full, ffmpeg-full,
util-linux, util-linux,
python3, python3,
getopt getopt,
nixosTests,
}: }:
let let
@ -28,7 +29,7 @@ let
pname = "${pname}-client"; pname = "${pname}-client";
inherit (source) version; inherit (source) version;
src = runCommand "cp-source" {} '' src = runCommand "cp-source" { } ''
cp -r ${src}/client $out cp -r ${src}/client $out
''; '';
@ -41,13 +42,28 @@ let
}; };
wrapper = import ./wrapper.nix { wrapper = import ./wrapper.nix {
inherit stdenv ffmpeg-full pname nodejs getopt; inherit
stdenv
ffmpeg-full
pname
nodejs
getopt
;
}; };
in buildNpmPackage { in
buildNpmPackage {
inherit pname src; inherit pname src;
inherit (source) version; inherit (source) version;
postPatch = ''
# Always skip version checks of the binary manager.
# We provide our own binaries, and don't want to trigger downloads.
substituteInPlace server/managers/BinaryManager.js --replace-fail \
'if (!this.validVersions.length) return true' \
'return true'
'';
buildInputs = [ util-linux ]; buildInputs = [ util-linux ];
nativeBuildInputs = [ python3 ]; nativeBuildInputs = [ python3 ];
@ -67,15 +83,21 @@ in buildNpmPackage {
chmod +x $out/bin/${pname} chmod +x $out/bin/${pname}
''; '';
passthru.updateScript = ./update.nu; passthru = {
tests.basic = nixosTests.audiobookshelf;
updateScript = ./update.nu;
};
meta = with lib; { meta = {
homepage = "https://www.audiobookshelf.org/"; homepage = "https://www.audiobookshelf.org/";
description = "Self-hosted audiobook and podcast server"; description = "Self-hosted audiobook and podcast server";
changelog = "https://github.com/advplyr/audiobookshelf/releases/tag/v${source.version}"; changelog = "https://github.com/advplyr/audiobookshelf/releases/tag/v${source.version}";
license = licenses.gpl3; license = lib.licenses.gpl3;
maintainers = [ maintainers.jvanbruegge maintainers.adamcstephens ]; maintainers = with lib.maintainers; [
platforms = platforms.linux; jvanbruegge
adamcstephens
];
platforms = lib.platforms.linux;
mainProgram = "audiobookshelf"; mainProgram = "audiobookshelf";
}; };
} }