audiobookshelf: add passthru.updateScript

This commit is contained in:
Adam Stephens
2024-01-18 14:52:16 -05:00
parent bb693ed6b6
commit e2a83fd442
3 changed files with 49 additions and 8 deletions
+11 -8
View File
@@ -15,19 +15,19 @@
let
nodejs = nodejs_18;
source = builtins.fromJSON (builtins.readFile ./source.json);
pname = "audiobookshelf";
version = "2.7.1";
src = fetchFromGitHub {
owner = "advplyr";
repo = pname;
rev = "v${version}";
sha256 = "sha256-ROxVAevnxCyND/h1yyXfUeK9v5SEULL8gkR3flTmmW8=";
rev = "refs/tags/v${source.version}";
inherit (source) hash;
};
client = buildNpmPackage {
pname = "${pname}-client";
inherit version;
inherit (source) version;
src = runCommand "cp-source" {} ''
cp -r ${src}/client $out
@@ -36,7 +36,7 @@ let
NODE_OPTIONS = "--openssl-legacy-provider";
npmBuildScript = "generate";
npmDepsHash = "sha256-2t/+IpmgTZglh3SSuYZNUvT1RZCDZGVT2gS57KU1mqA=";
npmDepsHash = source.clientDepsHash;
};
wrapper = import ./wrapper.nix {
@@ -44,14 +44,15 @@ let
};
in buildNpmPackage {
inherit pname version src;
inherit pname src;
inherit (source) version;
buildInputs = [ util-linux ];
nativeBuildInputs = [ python3 ];
dontNpmBuild = true;
npmInstallFlags = [ "--only-production" ];
npmDepsHash = "sha256-1VVFGc4RPE0FHQX1PeRnvU3cAq9eRYGfJ/0GzMy7Fh4=";
npmDepsHash = source.depsHash;
installPhase = ''
mkdir -p $out/opt/client
@@ -65,10 +66,12 @@ in buildNpmPackage {
chmod +x $out/bin/${pname}
'';
passthru.updateScript = ./update.nu;
meta = with lib; {
homepage = "https://www.audiobookshelf.org/";
description = "Self-hosted audiobook and podcast server";
changelog = "https://github.com/advplyr/audiobookshelf/releases/tag/v${version}";
changelog = "https://github.com/advplyr/audiobookshelf/releases/tag/v${source.version}";
license = licenses.gpl3;
maintainers = [ maintainers.jvanbruegge maintainers.adamcstephens ];
platforms = platforms.linux;
+9
View File
@@ -0,0 +1,9 @@
{
"owner": "advplyr",
"repo": "audiobookshelf",
"rev": "9a2b93fb377b6c18e2a5fc3a8f6b2ac827907e9a",
"hash": "sha256-ROxVAevnxCyND/h1yyXfUeK9v5SEULL8gkR3flTmmW8=",
"version": "2.7.1",
"depsHash": "sha256-1VVFGc4RPE0FHQX1PeRnvU3cAq9eRYGfJ/0GzMy7Fh4=",
"clientDepsHash": "sha256-2t/+IpmgTZglh3SSuYZNUvT1RZCDZGVT2gS57KU1mqA="
}
+29
View File
@@ -0,0 +1,29 @@
#!/usr/bin/env nix-shell
#!nix-shell -i nu -p nushell common-updater-scripts prefetch-npm-deps
def main [] {
let tags = list-git-tags --url=https://github.com/advplyr/audiobookshelf | lines | sort --natural | str replace v ''
let latest_tag = $tags | last
let current_version = open ./pkgs/servers/audiobookshelf/source.json | get version
if $latest_tag != $current_version {
let source = nix-prefetch-github advplyr audiobookshelf --rev $"v($latest_tag)" | from json | merge { version: $latest_tag, depsHash: "", clientDepsHash: ""}
$source | save --force $"(pwd)/pkgs/servers/audiobookshelf/source.json"
let srcPath = nix-build $env.PWD -A audiobookshelf.src | complete | get stdout | lines | first
print $srcPath
ls $srcPath
$source | merge {
depsHash: (prefetch-npm-deps $"($srcPath)/package-lock.json"),
clientDepsHash: (prefetch-npm-deps $"($srcPath)/client/package-lock.json")
} | save --force $"(pwd)/pkgs/servers/audiobookshelf/source.json"
# appease the editorconfig CI check
echo "\n" | save --append $"(pwd)/pkgs/servers/audiobookshelf/source.json"
}
{before: $current_version, after: $latest_tag}
}