golden-cheetah-bin: 3.6 -> 3.7DEV2410, add darwin (#363290)

* golden-cheetah-bin: format

Signed-off-by: Florian Brandes <florian.brandes@posteo.de>

* golden-cheetah-bin: 3.6 -> 3.7DEV2410

fixes CVE-2023-4863[1][2]

[1]: https://github.com/GoldenCheetah/GoldenCheetah/issues/4396
[2]: https://github.com/GoldenCheetah/GoldenCheetah/commit/e8132b1a55e8e84fc5e34a4c91e3a7b2bf62cc2f

* golden-cheetah-bin: fix qt startup

Due to a version missmatch between the packaged
Qt package from upstream and NixOS Qt version
GoldenCheetah will not be able to start with the following
error message on KDE:

```
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, xcb.
```

This is analog to other errors and is caused by a leaked QT_PLUGIN_PATH
variable from the host to the AppImage[1].

Since this only causes issues on KDE it is sufficient to empty the
variable from the desktop Menu item. This does not fix startup from
the command line and is rather a workaround than a true bugfix and the
underlying issue (leaking variables to appimageTools.wrapType2
applications) should be fixed.

This does not affect other desktop environments

[1]: https://discourse.nixos.org/t/cannot-run-ida-free-with-steam-run-could-not-load-the-qt-platform-plugin-xcb-in/29783

Signed-off-by: Florian Brandes <florian.brandes@posteo.de>

* golden-cheetah-bin: add darwin version

Signed-off-by: Florian Brandes <florian.brandes@posteo.de>

---------

Signed-off-by: Florian Brandes <florian.brandes@posteo.de>
This commit is contained in:
2024-12-16 19:31:58 -05:00
committed by GitHub
parent a2472aa8c9
commit 28b4ffa230
3 changed files with 119 additions and 31 deletions
@@ -0,0 +1,44 @@
{
fetchurl,
stdenv,
makeWrapper,
undmg,
pname,
commonMeta,
version,
}:
stdenv.mkDerivation {
inherit
pname
version
;
src = fetchurl {
url = "https://github.com/GoldenCheetah/GoldenCheetah/releases/download/v${version}/GoldenCheetah_v${builtins.substring 0 7 version}_x64.dmg";
hash = "sha256-GGe8pGf16FWqN9uaStnGOtOeKDB44VBD7QwHkaZb7wY=";
};
nativeBuildInputs = [
makeWrapper
undmg
];
dontBuild = true;
installPhase = ''
runHook preInstall
mkdir -p "$out/Applications/GoldenCheetah.app"
cp -r * "$out/Applications/GoldenCheetah.app/"
makeWrapper "$out/Applications/GoldenCheetah.app/Contents/MacOS/GoldenCheetah" "$out/bin/GoldenCheetah"
runHook postInstall
'';
meta = {
inherit (commonMeta)
description
platforms
maintainers
license
sourceProvenance
;
};
}
@@ -0,0 +1,45 @@
{
appimageTools,
fetchurl,
pname,
commonMeta,
version,
}:
appimageTools.wrapType2 rec {
inherit
pname
version
;
src = fetchurl {
url = "https://github.com/GoldenCheetah/GoldenCheetah/releases/download/v${version}/GoldenCheetah_v${builtins.substring 0 7 version}_x64.AppImage";
hash = "sha256-S1YDg7opoYflL/3h+lP1SNwXpJHaN3+iE3waSjWtN6o=";
};
extraPkgs = pkgs: [
pkgs.R
pkgs.zlib
pkgs.libusb-compat-0_1
];
appimageContents = appimageTools.extract { inherit pname src version; };
extraInstallCommands = ''
mv $out/bin/${pname} $out/bin/GoldenCheetah
mkdir -p $out/share/applications
mkdir -p $out/share/pixmaps
cp ${appimageContents}/GoldenCheetah.desktop $out/share/applications/
substituteInPlace $out/share/applications/GoldenCheetah.desktop --replace-fail \
"Exec=GoldenCheetah" "Exec=QT_PLUGIN_PATH= GoldenCheetah"
cp ${appimageContents}/gc.png $out/share/pixmaps/
'';
meta = {
inherit (commonMeta)
description
platforms
maintainers
license
sourceProvenance
;
};
}
+30 -31
View File
@@ -1,38 +1,37 @@
{ appimageTools, lib, fetchurl, nix-update-script, stdenv }:
{
lib,
stdenv,
callPackage,
}:
let
pname = "golden-cheetah";
version = "3.6";
version = "3.7-DEV2410";
src = fetchurl {
url = "https://github.com/GoldenCheetah/GoldenCheetah/releases/download/v${version}/GoldenCheetah_v${version}_x64.AppImage";
hash = "sha256-PMRUDQSQxbECbF9SPOo03t4Xxj1OtYJAPXEMyyy6EVY=";
};
appimageContents = appimageTools.extract { inherit pname src version; };
in
appimageTools.wrapType2 {
inherit pname src version;
extraPkgs = pkgs: [ pkgs.R pkgs.zlib pkgs.libusb-compat-0_1 ];
extraInstallCommands = ''
mv $out/bin/${pname} $out/bin/GoldenCheetah
mkdir -p $out/share/applications
mkdir -p $out/share/pixmaps
cp ${appimageContents}/GoldenCheetah.desktop $out/share/applications/
cp ${appimageContents}/gc.png $out/share/pixmaps/
'';
passthru.updateScript = nix-update-script { };
meta = {
commonMeta = {
description = "Performance software for cyclists, runners and triathletes. This version includes the API Tokens for e.g. Strava";
platforms = lib.platforms.linux;
broken = !stdenv.hostPlatform.isx86_64;
maintainers = with lib.maintainers; [ gador adamcstephens ];
platforms = [
"x86_64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
maintainers = with lib.maintainers; [
gador
adamcstephens
];
license = lib.licenses.gpl2Plus;
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
knownVulnerabilities = [ "Vendors libwebp vulnerable to CVE-2023-4863" ];
};
}
in
if stdenv.hostPlatform.isDarwin then
callPackage ./darwin.nix {
inherit
stdenv
pname
commonMeta
version
;
}
else
callPackage ./linux.nix { inherit pname commonMeta version; }