croc: 10.1.1 -> 10.1.3 (#364662)
[NixPkgs.git] / pkgs / by-name / sy / synthesia / package.nix
blob5667962fb0ddfac8e0b7aad4dddbd6c02a5fc471
2   lib,
3   fetchurl,
4   stdenvNoCC,
5   runtimeShell,
6   copyDesktopItems,
7   makeDesktopItem,
8   wineWowPackages,
9 }:
11 let
12   icon = fetchurl {
13     name = "synthesia.png";
14     url = "https://cdn.synthesia.app/images/headerIcon.png";
15     hash = "sha256-M9cQqHwwjko5pchdNtIMjYwd4joIvBphAYnpw73qYzM=";
16   };
18 stdenvNoCC.mkDerivation rec {
19   pname = "synthesia";
20   version = "10.9";
22   desktopItems = [
23     (makeDesktopItem {
24       name = "synthesia";
25       desktopName = "Synthesia";
26       comment = meta.description;
27       exec = "synthesia";
28       icon = "synthesia";
29       categories = [
30         "Game"
31         "Audio"
32       ];
33       startupWMClass = "synthesia.exe";
34     })
35   ];
37   nativeBuildInputs = [
38     copyDesktopItems
39     wineWowPackages.stable
40   ];
42   src = fetchurl {
43     url = "https://cdn.synthesia.app/files/Synthesia-${version}-installer.exe";
44     hash = "sha256-BFTsbesfMqxY1731ss6S0w8BcUaoqjVrr62VeU1BfrU=";
45   };
47   dontUnpack = true;
49   dontBuild = true;
51   installPhase = ''
52     runHook preInstall
53     mkdir -p $out/bin
54     cat <<'EOF' > $out/bin/synthesia
55     #!${runtimeShell}
56     export PATH=${wineWowPackages.stable}/bin:$PATH
57     export WINEARCH=win64
58     export WINEPREFIX="''${SYNTHESIA_HOME:-"''${XDG_DATA_HOME:-"''${HOME}/.local/share"}/synthesia"}/wine"
59     export WINEDLLOVERRIDES="mscoree=" # disable mono
60     if [ ! -d "$WINEPREFIX" ] ; then
61       mkdir -p "$WINEPREFIX"
62       wine ${src} /S
63     fi
64     wine "$WINEPREFIX/drive_c/Program Files (x86)/Synthesia/Synthesia.exe"
65     EOF
66     chmod +x $out/bin/synthesia
67     install -Dm644 ${icon} $out/share/icons/hicolor/48x48/apps/synthesia.png
68     runHook postInstall
69   '';
71   meta = with lib; {
72     description = "A fun way to learn how to play the piano";
73     homepage = "https://synthesiagame.com/";
74     downloadPage = "https://synthesiagame.com/download";
75     sourceProvenance = with sourceTypes; [ binaryNativeCode ];
76     license = licenses.unfree;
77     maintainers = with maintainers; [ ners ];
78     platforms = wineWowPackages.stable.meta.platforms;
79   };