bin.nix (1743B)
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 license = licenses.gpl3; 33 maintainers = [ maintainers.sikmir ]; 34 platforms = [ "x86_64-linux" "x86_64-darwin" ]; 35 skip.ci = true; 36 }; 37 38 linux = appimageTools.wrapType2 rec { 39 inherit pname version src meta; 40 41 extraInstallCommands = '' 42 mv $out/bin/{${pname}-${version},goldencheetah} 43 install -Dm644 ${appimageContents}/GoldenCheetah.desktop -t $out/share/applications 44 install -Dm644 ${appimageContents}/gc.png -t $out/share/icons/hicolor/256x256/apps 45 ''; 46 }; 47 48 darwin = stdenv.mkDerivation { 49 inherit pname version meta; 50 51 preferLocalBuild = true; 52 53 nativeBuildInputs = [ undmg ]; 54 55 installPhase = '' 56 mkdir -p $out/Applications/GoldenCheetah.app 57 cp -r . $out/Applications/GoldenCheetah.app 58 ''; 59 }; 60 in 61 if stdenv.isDarwin 62 then darwin 63 else linux