nixpkgs/pkgs/by-name/au/audiobookshelf/package.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

81 lines
1.8 KiB
Nix
Raw Normal View History

{
lib,
stdenv,
fetchFromGitHub,
runCommand,
buildNpmPackage,
nodejs_18,
tone,
ffmpeg-full,
util-linux,
python3,
getopt
}:
2023-01-29 02:20:37 +01:00
let
2023-05-10 12:44:11 +02:00
nodejs = nodejs_18;
2023-01-29 02:20:37 +01:00
source = builtins.fromJSON (builtins.readFile ./source.json);
2023-01-29 02:20:37 +01:00
pname = "audiobookshelf";
src = fetchFromGitHub {
owner = "advplyr";
repo = pname;
rev = "refs/tags/v${source.version}";
inherit (source) hash;
2023-01-29 02:20:37 +01:00
};
client = buildNpmPackage {
pname = "${pname}-client";
inherit (source) version;
2023-01-29 02:20:37 +01:00
src = runCommand "cp-source" {} ''
cp -r ${src}/client $out
'';
NODE_OPTIONS = "--openssl-legacy-provider";
npmBuildScript = "generate";
npmDepsHash = source.clientDepsHash;
2023-01-29 02:20:37 +01:00
};
wrapper = import ./wrapper.nix {
inherit stdenv ffmpeg-full tone pname nodejs getopt;
2023-01-29 02:20:37 +01:00
};
in buildNpmPackage {
inherit pname src;
inherit (source) version;
2023-01-29 02:20:37 +01:00
buildInputs = [ util-linux ];
2023-07-14 16:24:38 +02:00
nativeBuildInputs = [ python3 ];
2023-01-29 02:20:37 +01:00
dontNpmBuild = true;
npmInstallFlags = [ "--only-production" ];
npmDepsHash = source.depsHash;
2023-01-29 02:20:37 +01: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}
'';
passthru.updateScript = ./update.nu;
2023-01-29 02:20:37 +01:00
meta = with lib; {
homepage = "https://www.audiobookshelf.org/";
description = "Self-hosted audiobook and podcast server";
changelog = "https://github.com/advplyr/audiobookshelf/releases/tag/v${source.version}";
2023-01-29 02:20:37 +01:00
license = licenses.gpl3;
maintainers = [ maintainers.jvanbruegge maintainers.adamcstephens ];
2023-01-29 02:20:37 +01:00
platforms = platforms.linux;
2023-11-23 22:09:35 +01:00
mainProgram = "audiobookshelf";
2023-01-29 02:20:37 +01:00
};
}