about summary refs log tree commit diff
path: root/pkgs/by-name/au/audiobookshelf/package.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/by-name/au/audiobookshelf/package.nix')
-rw-r--r--pkgs/by-name/au/audiobookshelf/package.nix41
1 files changed, 31 insertions, 10 deletions
diff --git a/pkgs/by-name/au/audiobookshelf/package.nix b/pkgs/by-name/au/audiobookshelf/package.nix
index 6127e0e2b9f44..a1a4df946704e 100644
--- a/pkgs/by-name/au/audiobookshelf/package.nix
+++ b/pkgs/by-name/au/audiobookshelf/package.nix
@@ -5,11 +5,11 @@
   runCommand,
   buildNpmPackage,
   nodejs_18,
-  tone,
   ffmpeg-full,
   util-linux,
   python3,
-  getopt
+  getopt,
+  nixosTests,
 }:
 
 let
@@ -29,7 +29,7 @@ let
     pname = "${pname}-client";
     inherit (source) version;
 
-    src = runCommand "cp-source" {} ''
+    src = runCommand "cp-source" { } ''
       cp -r ${src}/client $out
     '';
 
@@ -42,13 +42,28 @@ let
   };
 
   wrapper = import ./wrapper.nix {
-    inherit stdenv ffmpeg-full tone pname nodejs getopt;
+    inherit
+      stdenv
+      ffmpeg-full
+      pname
+      nodejs
+      getopt
+      ;
   };
 
-in buildNpmPackage {
+in
+buildNpmPackage {
   inherit pname src;
   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 ];
   nativeBuildInputs = [ python3 ];
 
@@ -68,15 +83,21 @@ in buildNpmPackage {
     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/";
     description = "Self-hosted audiobook and podcast server";
     changelog = "https://github.com/advplyr/audiobookshelf/releases/tag/v${source.version}";
-    license = licenses.gpl3;
-    maintainers = [ maintainers.jvanbruegge maintainers.adamcstephens ];
-    platforms = platforms.linux;
+    license = lib.licenses.gpl3;
+    maintainers = with lib.maintainers; [
+      jvanbruegge
+      adamcstephens
+    ];
+    platforms = lib.platforms.linux;
     mainProgram = "audiobookshelf";
   };
 }