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