about summary refs log tree commit diff
path: root/nixpkgs/pkgs/games/clonehero/fhs-wrapper.nix
blob: 97758b2c1fabacc0a91686cce4c97ba6aa0923ac (plain) (blame)
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
{ clonehero-unwrapped
, makeDesktopItem
, buildFHSUserEnv
, liberation_ttf
, callPackage
}:

let
  name = "clonehero";
  desktopName = "Clone Hero";
  desktopItem = makeDesktopItem {
    inherit name desktopName;
    comment = clonehero-unwrapped.meta.description;
    exec = name;
    icon = name;
    categories = "Game;";
  };
in
buildFHSUserEnv {
  inherit name;
  inherit (clonehero-unwrapped) meta;

  # Clone Hero has /usr/share/fonts hard-coded in its binary for looking up fonts.
  # This workaround is necessary for rendering text on the keybinding screen (and possibly elsewhere)
  # If a better solution is found, the FHS environment can be removed.
  extraBuildCommands = ''
    chmod +w usr/share
    mkdir -p usr/share/fonts/truetype
    ln -s ${liberation_ttf}/share/fonts/truetype/* usr/share/fonts/truetype
  '';

  extraInstallCommands = ''
    mkdir -p "$out/share/applications" "$out/share/pixmaps"
    cp ${desktopItem}/share/applications/* "$out/share/applications"
    ln -s ${clonehero-unwrapped}/share/clonehero_Data/Resources/UnityPlayer.png "$out/share/pixmaps/${name}.png"
  '';

  runScript = callPackage ./xdg-wrapper.nix { };
}