This repository has been archived on 2024-10-13. You can view files and clone it, but cannot push or open issues or pull requests.
nix-packages/python/update.sh

32 lines
946 B
Bash
Raw Normal View History

2022-07-06 11:49:46 +00:00
#!/usr/bin/env nix-shell
#! nix-shell -i bash -p curl jq
set -e
2022-07-06 12:35:50 +00:00
PACKAGES="plover-plugins-manager plover-stroke rtf-tokenize plover-regenpfeifer plover-emoji plover-tapey-tape plover-yaml-dictionary simplefuzzyset ruamel.yaml ruamel.yaml.clib"
2022-07-06 11:49:46 +00:00
cat > tarballs.nix << EOF
{ inputs, pkgs }: let
inherit (pkgs) fetchurl;
in rec {
EOF
for package in $PACKAGES; do
JSON=$(curl "https://pypi.org/pypi/$package/json")
FILE_INFO=$(echo -E "$JSON" | jq '.releases[.info.version][] | select (.packagetype == "sdist")')
VERSION=$(echo -E "$JSON" | jq -r '.info.version')
URL=$(echo "$FILE_INFO" | jq -r '.url')
SHA256=$(echo "$FILE_INFO" | jq -r '.digests.sha256')
2022-07-06 12:31:20 +00:00
sanitized_package=$(echo $package | sed 's/\./-/g')
2022-07-06 11:49:46 +00:00
cat >> tarballs.nix << EOF
2022-07-06 12:31:20 +00:00
$sanitized_package-src = fetchurl {
2022-07-06 11:49:46 +00:00
url = "$URL";
sha256 = "$SHA256";
passthru.pname = "$package";
passthru.version = "$VERSION";
};
EOF
done
cat >> tarballs.nix << EOF
}
EOF