mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-01-07 13:33:12 +00:00
ad92065292
Until now we had the problem that the matrix team wasn't pinged on element changes because the version data is in a JSON and the position of the `version`-attribute wrongly pointed to `element-{web,desktop}.nix`: nix-instantiate -E 'with import ./. {}; builtins.unsafeGetAttrPos "version" element-web' --eval { column = 22; file = "/home/ma27/Projects/nixpkgs/pkgs/applications/networking/instant-messengers/element/element-web.nix"; line = 24; } This is a problem because ofborg checks if modified file is part of a derivation that got changed in a PR. I.e. only pings for element's maintainers would be added to an element update PR if `pin.json` (which gets modified in that case) would be recognized as file being a part of the changed derivations (element-web/element-desktop)[1] However, JSON imports don't propagate attribute positions (I don't know how one would that sanely implement btw), so I decided to change `pin.json` to a `pin.nix` and merge the relevant contents into element-web/element-desktop. This is kinda hacky, but as a maintainer I'd like to get modified if somebody touches element so I can review & merge that. With this change the position detection works fine now: { column = 3; file = "/home/ma27/Projects/nixpkgs/pkgs/applications/networking/instant-messengers/element/pin.nix"; line = 2; } [1] https://github.com/NixOS/ofborg/blob/released/ofborg/src/maintainers.nix
56 lines
1.4 KiB
Bash
Executable File
56 lines
1.4 KiB
Bash
Executable File
#!/usr/bin/env nix-shell
|
|
#!nix-shell -I nixpkgs=../../../../../ -i bash -p nix wget prefetch-yarn-deps nix-prefetch-github
|
|
|
|
if [ "$#" -gt 1 ] || [[ "$1" == -* ]]; then
|
|
echo "Regenerates packaging data for the element packages."
|
|
echo "Usage: $0 [git release tag]"
|
|
exit 1
|
|
fi
|
|
|
|
version="$1"
|
|
|
|
set -euo pipefail
|
|
|
|
if [ -z "$version" ]; then
|
|
version="$(wget -O- "https://api.github.com/repos/vector-im/element-desktop/releases?per_page=1" | jq -r '.[0].tag_name')"
|
|
fi
|
|
|
|
# strip leading "v"
|
|
version="${version#v}"
|
|
|
|
# Element Web
|
|
web_src="https://raw.githubusercontent.com/vector-im/element-web/v$version"
|
|
web_src_hash=$(nix-prefetch-github vector-im element-web --rev v${version} | jq -r .sha256)
|
|
|
|
web_tmpdir=$(mktemp -d)
|
|
trap 'rm -rf "$web_tmpdir"' EXIT
|
|
|
|
pushd $web_tmpdir
|
|
wget "$web_src/yarn.lock"
|
|
web_yarn_hash=$(prefetch-yarn-deps yarn.lock)
|
|
popd
|
|
|
|
# Element Desktop
|
|
desktop_src="https://raw.githubusercontent.com/vector-im/element-desktop/v$version"
|
|
desktop_src_hash=$(nix-prefetch-github vector-im element-desktop --rev v${version} | jq -r .sha256)
|
|
|
|
desktop_tmpdir=$(mktemp -d)
|
|
trap 'rm -rf "$desktop_tmpdir"' EXIT
|
|
|
|
pushd $desktop_tmpdir
|
|
wget "$desktop_src/yarn.lock"
|
|
desktop_yarn_hash=$(prefetch-yarn-deps yarn.lock)
|
|
popd
|
|
|
|
cat > pin.nix << EOF
|
|
{
|
|
"version" = "$version";
|
|
"hashes" = {
|
|
"desktopSrcHash" = "$desktop_src_hash";
|
|
"desktopYarnHash" = "$desktop_yarn_hash";
|
|
"webSrcHash" = "$web_src_hash";
|
|
"webYarnHash" = "$web_yarn_hash";
|
|
};
|
|
}
|
|
EOF
|