1{
2 stdenvNoCC,
3 lib,
4 requireFile,
5 asar,
6 copyDesktopItems,
7 electron,
8 makeDesktopItem,
9 makeWrapper,
10 unzip,
11
12 campaigns ? [ ],
13 cubes ? [ ],
14 constructed ? [ ],
15}:
16
17stdenvNoCC.mkDerivation (finalAttrs: {
18 pname = "ddm";
19 version = "4.1.0";
20
21 src = requireFile {
22 name = "DungeonDuelMonsters-linux-x64.zip";
23 hash = "sha256-gq2nGwpaStqaVI1pL63xygxOI/z53o+zLwiKizG98Ks=";
24 url = "https://mikaygo.itch.io/ddm";
25 };
26
27 strictDeps = true;
28
29 nativeBuildInputs = [
30 asar
31 copyDesktopItems
32 makeWrapper
33 unzip
34 ];
35
36 dontConfigure = true;
37 dontBuild = true;
38
39 installPhase = ''
40 runHook preInstall
41
42 mkdir -p $out/{bin,share/icons/hicolor/512x512/apps,share/ddm}
43
44 asar extract ./resources/app.asar $out/share/ddm/
45
46 patch -d $out/share/ddm/ -p1 < ${./0001-Make-findPath-its-calls-behave-well-with-store.patch}
47
48 ln -s $out/share/ddm/icon.png $out/share/icons/hicolor/512x512/apps/ddm.png
49
50 makeWrapper ${lib.getExe electron} $out/bin/ddm \
51 --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations --enable-wayland-ime=true}}" \
52 --add-flags "$out/share/ddm"
53
54 # Install externally-downloaded campaign packs and cube & constructed lists
55 mkdir $out/share/ddm/{campaigns,cubes,constructed}
56 ''
57 + lib.concatMapStringsSep "\n" (campaignZip: ''
58 unzip "${campaignZip}" -d $out/share/ddm/campaigns/
59 '') campaigns
60 + lib.concatMapStringsSep "\n" (cubeFile: ''
61 cp "${cubeFile}" $out/share/ddm/cubes/
62 '') cubes
63 + lib.concatMapStringsSep "\n" (constructedFile: ''
64 cp "${constructedFile}" $out/share/ddm/constructed/
65 '') constructed
66 + ''
67
68 runHook postInstall
69 '';
70
71 desktopItems = [
72 (makeDesktopItem {
73 name = "ddm";
74 desktopName = "Dungeon Duel Monsters";
75 comment = "A Tabletop Yugioh Experience";
76 exec = "ddm";
77 terminal = false;
78 icon = "ddm";
79 })
80 ];
81
82 meta = {
83 description = "Tabletop Yugioh Experience";
84 homepage = "https://dungeonduelmonsters.com";
85 changelog = "https://mikaygo.itch.io/ddm/devlog";
86 license = lib.licenses.unfree;
87 mainProgram = "ddm";
88 maintainers = with lib.maintainers; [ OPNA2608 ];
89 platforms = lib.platforms.linux;
90 };
91})