1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-26 07:31:20 +00:00

jellyfin: Use nuget-to-nix in updater script

This commit is contained in:
Zhaofeng Li 2021-08-11 23:26:36 -07:00
parent 48df5d49fa
commit f7acf65d7c
2 changed files with 455 additions and 2283 deletions

File diff suppressed because it is too large Load diff

View file

@ -1,5 +1,5 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p curl jq common-updater-scripts dotnetCorePackages.sdk_5_0 gnused nix coreutils findutils
#!nix-shell -i bash -p curl jq common-updater-scripts dotnetCorePackages.sdk_5_0 nuget-to-nix gnused nix coreutils findutils
set -euo pipefail
@ -31,22 +31,7 @@ pushd "$src"
mkdir ./nuget_tmp.packages
dotnet restore Jellyfin.Server --packages ./nuget_tmp.packages --runtime linux-x64
echo "# This file has been generated by the jellyfin updateScript. Do not edit!" >"$nugetDepsFile"
echo "{ fetchNuGet }: [" >>"$nugetDepsFile"
while read -r pkg_spec; do
{ read -r pkg_name; read -r pkg_version; } < <(
# Build version part should be ignored: `3.0.0-beta2.20059.3+77df2220` -> `3.0.0-beta2.20059.3`
sed -nE 's/.*<id>([^<]*).*/\1/p; s/.*<version>([^<+]*).*/\1/p' "$pkg_spec")
pkg_sha256="$(nix-hash --type sha256 --flat --base32 "$(dirname "$pkg_spec")"/*.nupkg)"
cat >>"$nugetDepsFile" <<EOF
(fetchNuGet {
name = "$pkg_name";
version = "$pkg_version";
sha256 = "$pkg_sha256";
})
EOF
done < <(find ./nuget_tmp.packages -name '*.nuspec' | sort)
echo "]" >>"$nugetDepsFile"
nuget-to-nix ./nuget_tmp.packages > "$nugetDepsFile"
popd
rm -r "$src"