discordchatexporter-cli: Use nuget-to-nix in updater script

This commit is contained in:
Zhaofeng Li 2021-08-11 23:26:36 -07:00
parent f7acf65d7c
commit 809dc67e52
2 changed files with 16 additions and 86 deletions

View File

@ -1,72 +1,16 @@
{ fetchNuGet }: [
(fetchNuGet {
name = "CliFx";
version = "2.0.6";
sha256 = "09yyjgpp52b0r3mqlvx75ld4vjp8hry7ql7r20nnvj0lach6fyh6";
})
(fetchNuGet {
name = "Gress";
version = "1.2.0";
sha256 = "0aidc9whi0718gh896j7xkyndki9x7rifd8n1n681afb2zbxw4bn";
})
(fetchNuGet {
name = "JsonExtensions";
version = "1.1.0";
sha256 = "1fqxb2jdbvjgg135wmy890qf63r056dq16jy7wgzkgp21m3j0lgy";
})
(fetchNuGet {
name = "Microsoft.AspNetCore.App.Ref";
version = "3.1.10";
sha256 = "0xn4zh7shvijqlr03fqsmps6gz856isd9bg9rk4z2c4599ggal77";
})
(fetchNuGet {
name = "Microsoft.NETCore.App.Host.linux-x64";
version = "3.1.14";
sha256 = "11rqnascx9asfyxgxzwgxgr9gxxndm552k4dn4p1s57ciz7vkg9h";
})
(fetchNuGet {
name = "Microsoft.NETCore.App.Ref";
version = "3.1.0";
sha256 = "08svsiilx9spvjamcnjswv0dlpdrgryhr3asdz7cvnl914gjzq4y";
})
(fetchNuGet {
name = "MiniRazor.CodeGen";
version = "2.1.4";
sha256 = "1856hfw2wl3ilxmpg4jmwpigmq0rm50i9pmy3sq8f1xc8j44kzl2";
})
(fetchNuGet {
name = "MiniRazor.Runtime";
version = "2.1.4";
sha256 = "1pc3kjbnz810a8bb94k6355rflmayigfmpfmc4jzzx6l6iavnnc4";
})
(fetchNuGet {
name = "Polly";
version = "7.2.2";
sha256 = "0s15n5zwj44i6sw3v40ca8l6j0ijydxcakvad49j52rp49iwrmkn";
})
(fetchNuGet {
name = "Spectre.Console";
version = "0.41.0";
sha256 = "104vyzwbbq5m75dm31xk7ilvmik8hw1cj3bc301a8w6gq8i0fpk3";
})
(fetchNuGet {
name = "Superpower";
version = "2.3.0";
sha256 = "0bdsc3c0d6jb0wr67siqfba0ldl0jxbwis6xr0whzqzf6m2cyahm";
})
(fetchNuGet {
name = "System.Memory";
version = "4.5.0";
sha256 = "1layqpcx1q4l805fdnj2dfqp6ncx2z42ca06rgsr6ikq4jjgbv30";
})
(fetchNuGet {
name = "Tyrrrz.Extensions";
version = "1.6.5";
sha256 = "1yzsii1pbp6b066wxwwws310p7h809apl81bhb8ad55hqlzy1rg3";
})
(fetchNuGet {
name = "Wcwidth";
version = "0.2.0";
sha256 = "0p7zaisix9ql4v5nyl9gfc93xcyj74j01rwvgm7jw29js3wlj10s";
})
(fetchNuGet { name = "CliFx"; version = "2.0.6"; sha256 = "09yyjgpp52b0r3mqlvx75ld4vjp8hry7ql7r20nnvj0lach6fyh6"; })
(fetchNuGet { name = "Gress"; version = "1.2.0"; sha256 = "0aidc9whi0718gh896j7xkyndki9x7rifd8n1n681afb2zbxw4bn"; })
(fetchNuGet { name = "JsonExtensions"; version = "1.1.0"; sha256 = "1fqxb2jdbvjgg135wmy890qf63r056dq16jy7wgzkgp21m3j0lgy"; })
(fetchNuGet { name = "Microsoft.AspNetCore.App.Ref"; version = "3.1.10"; sha256 = "0xn4zh7shvijqlr03fqsmps6gz856isd9bg9rk4z2c4599ggal77"; })
(fetchNuGet { name = "Microsoft.NETCore.App.Host.linux-x64"; version = "3.1.14"; sha256 = "11rqnascx9asfyxgxzwgxgr9gxxndm552k4dn4p1s57ciz7vkg9h"; })
(fetchNuGet { name = "Microsoft.NETCore.App.Ref"; version = "3.1.0"; sha256 = "08svsiilx9spvjamcnjswv0dlpdrgryhr3asdz7cvnl914gjzq4y"; })
(fetchNuGet { name = "MiniRazor.CodeGen"; version = "2.1.4"; sha256 = "1856hfw2wl3ilxmpg4jmwpigmq0rm50i9pmy3sq8f1xc8j44kzl2"; })
(fetchNuGet { name = "MiniRazor.Runtime"; version = "2.1.4"; sha256 = "1pc3kjbnz810a8bb94k6355rflmayigfmpfmc4jzzx6l6iavnnc4"; })
(fetchNuGet { name = "Polly"; version = "7.2.2"; sha256 = "0s15n5zwj44i6sw3v40ca8l6j0ijydxcakvad49j52rp49iwrmkn"; })
(fetchNuGet { name = "Spectre.Console"; version = "0.41.0"; sha256 = "104vyzwbbq5m75dm31xk7ilvmik8hw1cj3bc301a8w6gq8i0fpk3"; })
(fetchNuGet { name = "Superpower"; version = "2.3.0"; sha256 = "0bdsc3c0d6jb0wr67siqfba0ldl0jxbwis6xr0whzqzf6m2cyahm"; })
(fetchNuGet { name = "System.Memory"; version = "4.5.0"; sha256 = "1layqpcx1q4l805fdnj2dfqp6ncx2z42ca06rgsr6ikq4jjgbv30"; })
(fetchNuGet { name = "Tyrrrz.Extensions"; version = "1.6.5"; sha256 = "1yzsii1pbp6b066wxwwws310p7h809apl81bhb8ad55hqlzy1rg3"; })
(fetchNuGet { name = "Wcwidth"; version = "0.2.0"; sha256 = "0p7zaisix9ql4v5nyl9gfc93xcyj74j01rwvgm7jw29js3wlj10s"; })
]

View File

@ -1,5 +1,5 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p curl jq common-updater-scripts dotnet-sdk_5
#!nix-shell -i bash -p curl jq common-updater-scripts nuget-to-nix dotnet-sdk_5
set -eo pipefail
cd "$(dirname "${BASH_SOURCE[0]}")"
@ -24,21 +24,7 @@ pushd "$src"
mkdir ./nuget_tmp.packages
dotnet restore DiscordChatExporter.Cli/DiscordChatExporter.Cli.csproj --packages ./nuget_tmp.packages
echo "{ fetchNuGet }: [" >"$deps_file"
while read pkg_spec; do
{ read pkg_name; read 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 >>"$deps_file" <<EOF
(fetchNuGet {
name = "$pkg_name";
version = "$pkg_version";
sha256 = "$pkg_sha256";
})
EOF
done < <(find ./nuget_tmp.packages -name '*.nuspec' | sort)
echo "]" >>"$deps_file"
nuget-to-nix ./nuget_tmp.packages > "$deps_file"
popd
rm -r "$src"