Unverified Commit eb42a295 authored by Adam C. Stephens's avatar Adam C. Stephens Committed by GitHub
Browse files

Merge pull request #281851 from adamcstephens/abs/2.7.2

audiobookshelf: 2.7.1 -> 2.7.2, add updatescript, move to by-name
parents 31347dd8 85c4a23b
Loading
Loading
Loading
Loading
+12 −9
Original line number Diff line number Diff line
@@ -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,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";
  };
+9 −0
Original line number Diff line number Diff line
{
  "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 −0
Original line number Diff line number Diff line
#!/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}
}
+0 −2
Original line number Diff line number Diff line
@@ -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 { };