bin.nix (1806B)
1 { lib, stdenv, fetchfromgh, appimageTools, undmg }: 2 let 3 inherit (stdenv.hostPlatform) system; 4 throwSystem = throw "Unsupported system: ${system}"; 5 6 pname = "goldencheetah-bin"; 7 version = "3.5"; 8 9 suffix = { 10 x86_64-linux = "amd64_Linux.AppImage"; 11 x86_64-darwin = "64bit_MacOS.dmg"; 12 }.${system} or throwSystem; 13 14 src = fetchfromgh { 15 owner = "GoldenCheetah"; 16 repo = "GoldenCheetah"; 17 version = "V${version}"; 18 name = "GoldenCheetah_v${version}_${suffix}"; 19 sha256 = { 20 x86_64-linux = "07ixivsp5j05a3zsbqx5jf11x7m3rcqaw095qjqrwd0nq0nmmhg8"; 21 x86_64-darwin = "0alg0a071lpkx0v3qqkqbb93vh1nsb3d7czxl9m15v17akp8nl82"; 22 }.${system} or throwSystem; 23 }; 24 25 appimageContents = appimageTools.extract { 26 inherit pname version src; 27 }; 28 29 meta = with lib; { 30 description = "Performance software for cyclists, runners and triathletes"; 31 homepage = "https://www.goldencheetah.org/"; 32 sourceProvenance = with sourceTypes; [ binaryNativeCode ]; 33 license = licenses.gpl3; 34 maintainers = [ maintainers.sikmir ]; 35 platforms = [ "x86_64-linux" "x86_64-darwin" ]; 36 skip.ci = true; 37 }; 38 39 linux = appimageTools.wrapType2 rec { 40 inherit pname version src meta; 41 42 extraInstallCommands = '' 43 mv $out/bin/{${pname}-${version},goldencheetah} 44 install -Dm644 ${appimageContents}/GoldenCheetah.desktop -t $out/share/applications 45 install -Dm644 ${appimageContents}/gc.png -t $out/share/icons/hicolor/256x256/apps 46 ''; 47 }; 48 49 darwin = stdenv.mkDerivation { 50 inherit pname version meta; 51 52 preferLocalBuild = true; 53 54 nativeBuildInputs = [ undmg ]; 55 56 installPhase = '' 57 mkdir -p $out/Applications/GoldenCheetah.app 58 cp -r . $out/Applications/GoldenCheetah.app 59 ''; 60 }; 61 in 62 if stdenv.isDarwin 63 then darwin 64 else linux