depot/third_party/nixpkgs/pkgs/servers/nosql/eventstore/create-deps.sh
Default email 8ac5e011d6 Project import generated by Copybara.
GitOrigin-RevId: 2c3273caa153ee8eb5786bc8141b85b859e7efd7
2020-04-24 19:36:52 -04:00

34 lines
768 B
Bash

# 1. create a log with `dotnet restore -v m MyPackage.sln > mypackage-restore.log
# 2. then call ./create-deps.sh mypackage-restore.log
urlbase="https://www.nuget.org/api/v2/package"
cat << EOL
{ fetchurl }: let
fetchNuGet = { name, version, sha256 }: fetchurl {
inherit sha256;
url = "$urlbase/\${name}/\${version}";
};
in [
EOL
IFS=''
while read line; do
if echo $line | grep -q "Installing "; then
name=$(echo $line | sed -r 's/ Installing ([^ ]+) (.+)./\1/')
version=$(echo $line | sed -r 's/ Installing ([^ ]+) (.+)./\2/')
sha256=$(nix-prefetch-url "$urlbase/$name/$version" 2>/dev/null)
cat << EOL
(fetchNuGet {
name = "$name";
version = "$version";
sha256 = "$sha256";
})
EOL
fi
done < $1
cat << EOL
]
EOL