From bb693ed6b6692d421513eec83c09e9155b0eace4 Mon Sep 17 00:00:00 2001 From: Adam Stephens Date: Thu, 18 Jan 2024 14:18:12 -0500 Subject: [PATCH 1/4] audiobookshelf: add adamcstephens to maintainers --- pkgs/servers/audiobookshelf/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/servers/audiobookshelf/default.nix b/pkgs/servers/audiobookshelf/default.nix index 52775068fba2..4b075498e759 100644 --- a/pkgs/servers/audiobookshelf/default.nix +++ b/pkgs/servers/audiobookshelf/default.nix @@ -70,7 +70,7 @@ in buildNpmPackage { description = "Self-hosted audiobook and podcast server"; changelog = "https://github.com/advplyr/audiobookshelf/releases/tag/v${version}"; license = licenses.gpl3; - maintainers = [ maintainers.jvanbruegge ]; + maintainers = [ maintainers.jvanbruegge maintainers.adamcstephens ]; platforms = platforms.linux; mainProgram = "audiobookshelf"; }; From e2a83fd442e4b7cb7d37e352832cd4fc2b92f451 Mon Sep 17 00:00:00 2001 From: Adam Stephens Date: Thu, 18 Jan 2024 14:17:33 -0500 Subject: [PATCH 2/4] audiobookshelf: add passthru.updateScript --- pkgs/servers/audiobookshelf/default.nix | 19 +++++++++------- pkgs/servers/audiobookshelf/source.json | 9 ++++++++ pkgs/servers/audiobookshelf/update.nu | 29 +++++++++++++++++++++++++ 3 files changed, 49 insertions(+), 8 deletions(-) create mode 100644 pkgs/servers/audiobookshelf/source.json create mode 100755 pkgs/servers/audiobookshelf/update.nu diff --git a/pkgs/servers/audiobookshelf/default.nix b/pkgs/servers/audiobookshelf/default.nix index 4b075498e759..01d49a5fee69 100644 --- a/pkgs/servers/audiobookshelf/default.nix +++ b/pkgs/servers/audiobookshelf/default.nix @@ -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; diff --git a/pkgs/servers/audiobookshelf/source.json b/pkgs/servers/audiobookshelf/source.json new file mode 100644 index 000000000000..825d98d847a4 --- /dev/null +++ b/pkgs/servers/audiobookshelf/source.json @@ -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=" +} diff --git a/pkgs/servers/audiobookshelf/update.nu b/pkgs/servers/audiobookshelf/update.nu new file mode 100755 index 000000000000..005d0193a076 --- /dev/null +++ b/pkgs/servers/audiobookshelf/update.nu @@ -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} +} From 6a1c2f6836072633b1d246f75c3fefeed27480f6 Mon Sep 17 00:00:00 2001 From: Adam Stephens Date: Thu, 18 Jan 2024 14:21:47 -0500 Subject: [PATCH 3/4] audiobookshelf: move to pkgs/by-name --- .../au/audiobookshelf/package.nix} | 0 pkgs/{servers => by-name/au}/audiobookshelf/source.json | 0 pkgs/{servers => by-name/au}/audiobookshelf/update.nu | 9 +++++---- pkgs/{servers => by-name/au}/audiobookshelf/wrapper.nix | 0 pkgs/top-level/all-packages.nix | 2 -- 5 files changed, 5 insertions(+), 6 deletions(-) rename pkgs/{servers/audiobookshelf/default.nix => by-name/au/audiobookshelf/package.nix} (100%) rename pkgs/{servers => by-name/au}/audiobookshelf/source.json (100%) rename pkgs/{servers => by-name/au}/audiobookshelf/update.nu (73%) rename pkgs/{servers => by-name/au}/audiobookshelf/wrapper.nix (100%) diff --git a/pkgs/servers/audiobookshelf/default.nix b/pkgs/by-name/au/audiobookshelf/package.nix similarity index 100% rename from pkgs/servers/audiobookshelf/default.nix rename to pkgs/by-name/au/audiobookshelf/package.nix diff --git a/pkgs/servers/audiobookshelf/source.json b/pkgs/by-name/au/audiobookshelf/source.json similarity index 100% rename from pkgs/servers/audiobookshelf/source.json rename to pkgs/by-name/au/audiobookshelf/source.json diff --git a/pkgs/servers/audiobookshelf/update.nu b/pkgs/by-name/au/audiobookshelf/update.nu similarity index 73% rename from pkgs/servers/audiobookshelf/update.nu rename to pkgs/by-name/au/audiobookshelf/update.nu index 005d0193a076..25166c9cf1d1 100755 --- a/pkgs/servers/audiobookshelf/update.nu +++ b/pkgs/by-name/au/audiobookshelf/update.nu @@ -2,14 +2,15 @@ #!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 ./pkgs/servers/audiobookshelf/source.json | get version + 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 $"(pwd)/pkgs/servers/audiobookshelf/source.json" + $source | save --force $sourceFile let srcPath = nix-build $env.PWD -A audiobookshelf.src | complete | get stdout | lines | first @@ -19,10 +20,10 @@ def main [] { $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" + } | save --force $sourceFile # appease the editorconfig CI check - echo "\n" | save --append $"(pwd)/pkgs/servers/audiobookshelf/source.json" + echo "\n" | save --append $sourceFile } {before: $current_version, after: $latest_tag} diff --git a/pkgs/servers/audiobookshelf/wrapper.nix b/pkgs/by-name/au/audiobookshelf/wrapper.nix similarity index 100% rename from pkgs/servers/audiobookshelf/wrapper.nix rename to pkgs/by-name/au/audiobookshelf/wrapper.nix diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 961f8c4d61cd..cab33571a1a5 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -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 { }; From 85c4a23b3968c4dbb43738b47de22257a32f6ed6 Mon Sep 17 00:00:00 2001 From: Adam Stephens Date: Thu, 18 Jan 2024 14:54:11 -0500 Subject: [PATCH 4/4] audiobookshelf: 2.7.1 -> 2.7.2 Changelog: https://github.com/advplyr/audiobookshelf/releases/tag/v2.7.2 --- pkgs/by-name/au/audiobookshelf/source.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pkgs/by-name/au/audiobookshelf/source.json b/pkgs/by-name/au/audiobookshelf/source.json index 825d98d847a4..74a387587170 100644 --- a/pkgs/by-name/au/audiobookshelf/source.json +++ b/pkgs/by-name/au/audiobookshelf/source.json @@ -1,9 +1,9 @@ { "owner": "advplyr", "repo": "audiobookshelf", - "rev": "9a2b93fb377b6c18e2a5fc3a8f6b2ac827907e9a", - "hash": "sha256-ROxVAevnxCyND/h1yyXfUeK9v5SEULL8gkR3flTmmW8=", - "version": "2.7.1", - "depsHash": "sha256-1VVFGc4RPE0FHQX1PeRnvU3cAq9eRYGfJ/0GzMy7Fh4=", - "clientDepsHash": "sha256-2t/+IpmgTZglh3SSuYZNUvT1RZCDZGVT2gS57KU1mqA=" + "rev": "90f4833c9e0957f08799af15966d1909516b335e", + "hash": "sha256-m+CwUV3Bu9sHvRKCA1vFXYYRx48bxZ8N3BornO1tLQ0=", + "version": "2.7.2", + "depsHash": "sha256-1623oXtkOp43xQvHI3GbJpEQLvgr5WD5FpfNO+d0RR8=", + "clientDepsHash": "sha256-ugf9C/L5aBTO7gCy561kV06Ihb/mg/ZW916NKngIYXI=" }