Skip to content

Commit

Permalink
Merge pull request #281851 from adamcstephens/abs/2.7.2
Browse files Browse the repository at this point in the history
audiobookshelf: 2.7.1 -> 2.7.2, add updatescript, move to by-name
  • Loading branch information
adamcstephens authored Jan 19, 2024
2 parents 31347dd + 85c4a23 commit eb42a29
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -36,22 +36,23 @@ let
NODE_OPTIONS = "--openssl-legacy-provider";

npmBuildScript = "generate";
npmDepsHash = "sha256-2t/+IpmgTZglh3SSuYZNUvT1RZCDZGVT2gS57KU1mqA=";
npmDepsHash = source.clientDepsHash;
};

wrapper = import ./wrapper.nix {
inherit stdenv ffmpeg-full tone pname nodejs getopt;
};

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
Expand All @@ -65,12 +66,14 @@ 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 = [ maintainers.jvanbruegge maintainers.adamcstephens ];
platforms = platforms.linux;
mainProgram = "audiobookshelf";
};
Expand Down
9 changes: 9 additions & 0 deletions pkgs/by-name/au/audiobookshelf/source.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"owner": "advplyr",
"repo": "audiobookshelf",
"rev": "90f4833c9e0957f08799af15966d1909516b335e",
"hash": "sha256-m+CwUV3Bu9sHvRKCA1vFXYYRx48bxZ8N3BornO1tLQ0=",
"version": "2.7.2",
"depsHash": "sha256-1623oXtkOp43xQvHI3GbJpEQLvgr5WD5FpfNO+d0RR8=",
"clientDepsHash": "sha256-ugf9C/L5aBTO7gCy561kV06Ihb/mg/ZW916NKngIYXI="
}
30 changes: 30 additions & 0 deletions pkgs/by-name/au/audiobookshelf/update.nu
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env nix-shell
#!nix-shell -i nu -p nushell common-updater-scripts prefetch-npm-deps

def main [] {
let sourceFile = $"(pwd)/pkgs/by-name/au/audiobookshelf/source.json"
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 $sourceFile | 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 $sourceFile

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 $sourceFile

# appease the editorconfig CI check
echo "\n" | save --append $sourceFile
}

{before: $current_version, after: $latest_tag}
}
File renamed without changes.
2 changes: 0 additions & 2 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -1721,8 +1721,6 @@ with pkgs;

audible-cli = callPackage ../tools/misc/audible-cli { };

audiobookshelf = callPackage ../servers/audiobookshelf { };

auditwheel = with python3Packages; toPythonApplication auditwheel;

amidst = callPackage ../tools/games/minecraft/amidst { };
Expand Down

0 comments on commit eb42a29

Please sign in to comment.