github-desktop: add update script

This commit is contained in:
Tom van Dijk
2026-04-11 21:58:02 +02:00
parent 4304e214d0
commit 93a1818f1b
2 changed files with 44 additions and 0 deletions
@@ -23,6 +23,9 @@
gnome-keyring,
libsecret,
curl,
_experimental-update-script-combinators,
nix-update-script,
}:
let
@@ -177,6 +180,20 @@ stdenv.mkDerivation (finalAttrs: {
runHook postInstall
'';
passthru = {
inherit (finalAttrs) cacheRoot cacheApp;
updateScript = _experimental-update-script-combinators.sequence [
(nix-update-script {
extraArgs = [
"--version-regex"
''^release-(\d\.\d\.\d)$''
];
})
# TODO: in the future, use `nix-update --custom-dep`.
./update-yarn-caches.sh
];
};
meta = {
description = "GUI for managing Git and GitHub";
homepage = "https://desktop.github.com";
+27
View File
@@ -0,0 +1,27 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p nix gnused common-updater-scripts
set -euxo pipefail
cd "$(dirname $0)"
setKV() {
sed -i "s|$1 = \".*\"|$1 = \"${2:-}\"|" package.nix
}
for cache in cacheApp cacheRoot; do
hashKey="${cache}Hash"
setKV "$hashKey" sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
pushd ../../../..
set +e
newHash="$(nix-build --no-out-link -A github-desktop.$cache 2>&1 >/dev/null | grep "got:" | cut -d':' -f2 | sed 's| ||g')"
set -e
popd
if [ -z "$newHash" ]; then
echo Failed to update hash for $cache
exit 1
fi
setKV "$hashKey" "$newHash"
done