nextcloud-talk-desktop: correct hash, set updateScript, use patchelf in argument (#468530)

This commit is contained in:
Michael Daniels
2025-12-13 01:34:34 +00:00
committed by GitHub
2 changed files with 55 additions and 9 deletions
@@ -21,13 +21,17 @@
libglvnd,
systemd,
patchelf,
nix-update-script,
undmg,
makeWrapper,
}:
let
pname = "nextcloud-talk-desktop";
version = "2.0.4";
version = "2.0.4"; # Ensure both hashes (Linux and Darwin) are updated!
hashes = {
linux = "sha256-Nky3ws1UV0F4qjbBog53BjXkZ/ttTER/32NlB2ONJaE=";
darwin = "sha256-N/v1842rheqrjG4pAwrSDYNWhQDgWinTiZPusD1dvaM=";
};
# Only x86_64-linux is supported with Darwin support being universal
sources = {
@@ -35,15 +39,20 @@ let
# See https://github.com/nextcloud/talk-desktop?tab=readme-ov-file#%EF%B8%8F-prerequisites
linux = fetchzip {
url = "https://github.com/nextcloud-releases/talk-desktop/releases/download/v${version}/Nextcloud.Talk-linux-x64.zip";
hash = "sha256-Nky3ws1UV0F4qjbBog53BjXkZ/ttTER/32NlB2ONJaE=";
hash = hashes.linux;
stripRoot = false;
};
darwin = fetchurl {
url = "https://github.com/nextcloud-releases/talk-desktop/releases/download/v${version}/Nextcloud.Talk-macos-universal.dmg";
hash = "sha256-FgiUb2MNEqmbK4BphHQ7M2IeN7Vg1NQ9FR9UO4AfvNs=";
hash = hashes.darwin;
};
};
passthru = {
inherit hashes; # needed by updateScript
updateScript = ./update.py;
};
meta = {
description = "Nextcloud Talk Desktop Client";
homepage = "https://github.com/nextcloud/talk-desktop";
@@ -55,7 +64,7 @@ let
};
linux = stdenv.mkDerivation (finalAttrs: {
inherit pname version;
inherit pname version passthru;
src = sources.linux;
@@ -127,19 +136,17 @@ let
'';
postFixup = ''
patchelf --add-needed libGL.so.1 --add-needed libEGL.so.1 \
${lib.getExe patchelf} --add-needed libGL.so.1 --add-needed libEGL.so.1 \
"$out/opt/Nextcloud Talk-linux-x64/Nextcloud Talk"
'';
passthru.updateScript = nix-update-script { };
meta = meta // {
platforms = lib.intersectLists lib.platforms.linux lib.platforms.x86_64;
};
});
darwin = stdenv.mkDerivation (finalAttrs: {
inherit pname version;
inherit pname version passthru;
src = sources.darwin;
+39
View File
@@ -0,0 +1,39 @@
#!/usr/bin/env nix-shell
#!nix-shell -i python3 -p python3 bash nix-update jq
import subprocess
from os.path import join, dirname
# This will set the version correctly,
# and will also set the hash for x86_64-linux.
subprocess.run(["nix-update", "nextcloud-talk-desktop"])
# Now get the hash for Darwin.
# (It's the same for both Darwin platforms, and we don't support aarch64-linux).
newVer = subprocess.run(
["nix-instantiate", "--eval", "--raw", "-A", "nextcloud-talk-desktop.version"], capture_output=True, encoding="locale"
).stdout
darwinUrl = (
f"https://github.com/nextcloud-releases/talk-desktop/releases/download/v{newVer}/Nextcloud.Talk-macos-universal.dmg"
)
oldDarwinHash = subprocess.run(
["nix-instantiate", "--eval", "--raw", "-A", f"nextcloud-talk-desktop.passthru.hashes.darwin"],
capture_output=True,
encoding="locale",
).stdout
newDarwinHash = subprocess.run(
["bash", "-c", f"nix store prefetch-file {darwinUrl} --json | jq -r '.hash'"],
capture_output=True,
encoding="locale",
).stdout.strip() # Has a newline
with open(join(dirname(__file__), "package.nix"), "r") as f:
txt = f.read()
txt = txt.replace(oldDarwinHash, newDarwinHash)
with open(join(dirname(__file__), "package.nix"), "w") as f:
f.write(txt)