From 4d8e51f91762b98518b083456ceef02e6c515677 Mon Sep 17 00:00:00 2001 From: eljamm Date: Fri, 6 Feb 2026 10:51:58 +0100 Subject: [PATCH] sylk: 3.7.0 -> 3.8.0; build from source --- pkgs/by-name/sy/sylk/package.nix | 137 +++++++++++++++++++++++++------ 1 file changed, 113 insertions(+), 24 deletions(-) diff --git a/pkgs/by-name/sy/sylk/package.nix b/pkgs/by-name/sy/sylk/package.nix index f96678b48724..6a8bb4933279 100644 --- a/pkgs/by-name/sy/sylk/package.nix +++ b/pkgs/by-name/sy/sylk/package.nix @@ -1,48 +1,137 @@ { - appimageTools, - fetchurl, lib, - libxshmfence, + stdenv, + fetchFromGitHub, + fetchYarnDeps, + copyDesktopItems, + electron, + fixup-yarn-lock, + imagemagick, + makeDesktopItem, + node-gyp-build, + nodejs, + writableTmpDirAsHomeHook, + yarnBuildHook, + yarnConfigHook, + yarnInstallHook, }: -appimageTools.wrapType2 rec { +stdenv.mkDerivation (finalAttrs: { pname = "sylk"; - version = "3.7.0"; + version = "3.8.0"; - src = fetchurl { - url = "https://download.ag-projects.com/Sylk/Sylk-${version}-x86_64.AppImage"; - hash = "sha256-3lWWc3aSn+aKM/gX4v2suVbj5sZPKl1r36eQP3a2pNg="; + src = fetchFromGitHub { + owner = "AGProjects"; + repo = "sylk-webrtc"; + tag = finalAttrs.version; + hash = "sha256-AJbZDAEqGfVPuo+My8wxfFWVPelO6XK2pKsglmLyRTw="; }; - extraPkgs = pkgs: [ - libxshmfence + yarnOfflineCache = fetchYarnDeps { + yarnLock = finalAttrs.src + "/yarn.lock"; + hash = "sha256-VY97NPnT1225l6SLyTI3qITBGF7rqE5xz6UVVucblcU="; + }; + + # required for electron + passthru.appOfflineCache = fetchYarnDeps { + yarnLock = finalAttrs.src + "/app/yarn.lock"; + hash = "sha256-S9L/rveTuXF2vSqSDu+NlV5vP5f28lda/KMGU8iS1Zo="; + }; + + outputs = [ + "out" + "deps" + "electronDeps" ]; - appimageContents = appimageTools.extractType2 { inherit pname version src; }; + nativeBuildInputs = [ + copyDesktopItems + fixup-yarn-lock + imagemagick + node-gyp-build + nodejs # needed for executing package.json scripts + writableTmpDirAsHomeHook + yarnBuildHook + yarnConfigHook + yarnInstallHook + ]; - extraInstallCommands = '' - install -Dm444 ${appimageContents}/sylk-electron.desktop -t $out/share/applications/ - install -Dm444 ${appimageContents}/sylk-electron.png -t $out/share/icons/hicolor/512x512/apps/ + dontConfigure = true; + yarnBuildScript = "electron"; - substituteInPlace $out/share/applications/sylk-electron.desktop \ - --replace-fail 'Exec=AppRun --no-sandbox' 'Exec=${pname}' + preBuild = '' + originalOfflineMirror=$(yarn config --offline get yarn-offline-mirror) + + installDeps() { + local cache="$1" + local output="$2" + fixup-yarn-lock yarn.lock + yarn config --offline set yarn-offline-mirror "$cache" + yarn install --offline --frozen-lockfile --ignore-engines --ignore-scripts + patchShebangs node_modules/ + mkdir -p $output + cp -R node_modules $output + } + + installDeps $yarnOfflineCache $deps + + pushd app + installDeps ${finalAttrs.passthru.appOfflineCache} $electronDeps + popd + + yarn config --offline set yarn-offline-mirror $originalOfflineMirror ''; - profile = '' - export LC_ALL=C.UTF-8 + postFixup = '' + mkdir -p $out/share + mv $out/lib/node_modules/Sylk $out/share/Sylk + + rm -rf $out/lib + rm -rf $out/share/Sylk/.parcel-cache + rm -rf $out/share/Sylk/node_modules + + ln -s $electronDeps/node_modules $out/share/Sylk/app/node_modules + ln -s $deps/node_modules $out/share/Sylk/node_modules + + makeWrapper ${lib.getExe electron} $out/bin/sylk \ + --add-flags $out/share/Sylk/app \ + --inherit-argv0 + + # Convert the .ico file to PNGs, which are used by the desktop file + for size in 16 24 32 48 64 128 256; do + mkdir -p $out/share/icons/hicolor/"$size"x"$size"/apps + magick "$out/share/Sylk/build/icon.ico" -delete 1--1 \ + -background none \ + -thumbnail "$size"x"$size" \ + $out/share/icons/hicolor/"$size"x"$size"/apps/sylk-electron.png + done; ''; + desktopItems = [ + (makeDesktopItem { + name = "sylk"; + exec = "sylk"; + desktopName = "Sylk"; + comment = "WebRTC client"; + icon = "sylk-electron"; + startupWMClass = "Sylk"; + terminal = false; + categories = [ + "Audio" + "Video" + "AudioVideo" + ]; + }) + ]; + meta = { description = "Desktop client for SylkServer, a multiparty conferencing tool"; homepage = "https://sylkserver.com/"; license = lib.licenses.agpl3Plus; + changelog = "https://github.com/AGProjects/sylk-webrtc/blob/${finalAttrs.src.rev}/changelog.txt"; mainProgram = "sylk"; maintainers = with lib.maintainers; [ zimbatm ]; teams = with lib.teams; [ ngi ]; - platforms = [ - "i386-linux" - "x86_64-linux" - ]; - sourceProvenance = [ lib.sourceTypes.binaryNativeCode ]; + platforms = electron.meta.platforms; }; -} +})