Unverified Commit f41852b9 authored by Gaétan Lepage's avatar Gaétan Lepage Committed by GitHub
Browse files

a-keys-path: init at 0.7.1 (#373994)

parents d57b2746 ed500e2e
Loading
Loading
Loading
Loading
+24 −0
Original line number Diff line number Diff line
[preset.0]

name="Linux"
platform="Linux/X11"
runnable=true
custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path=""
script_export_mode=1
script_encryption_key=""

[preset.0.options]

custom_template/debug=""
custom_template/release=""
binary_format/64_bits=true
binary_format/embed_pck=false
texture_format/bptc=false
texture_format/s3tc=true
texture_format/etc=false
texture_format/etc2=false
texture_format/no_bptc_fallbacks=true
+121 −0
Original line number Diff line number Diff line
# copied from oh-my-git/package.nix by @jojosch (Johannes Schleifenbaum)
# added in nixos/nixpkgs#119642
{
  lib,
  autoPatchelfHook,
  copyDesktopItems,
  fetchFromGitHub,
  makeDesktopItem,
  stdenv,
  alsa-lib,
  godot3-export-templates,
  godot3-headless,
  libX11,
  libXcursor,
  libXext,
  libXi,
  libXinerama,
  libXrandr,
  libXrender,
  libglvnd,
  writableTmpDirAsHomeHook,
}:
stdenv.mkDerivation (finalAttrs: {
  pname = "a-keys-path";
  version = "0.7.1";

  src = fetchFromGitHub {
    owner = "geegaz";
    repo = "A-Key-s-Path";
    tag = "v${finalAttrs.version}";
    hash = "sha256-i9INPB883/0fmtZgJpVpsA/7Q51DHOMWvkLF9hKE6gQ=";
  };

  nativeBuildInputs = [
    autoPatchelfHook
    copyDesktopItems
    godot3-headless

    # Cannot create file '/homeless-shelter/.config/godot/projects/...'
    writableTmpDirAsHomeHook
  ];

  buildInputs = [
    libX11
    libXcursor
    libXext
    libXi
    libXinerama
    libXrandr
    libXrender
    libglvnd
  ];

  desktopItem = makeDesktopItem {
    name = "a-keys-path";
    exec = "a-keys-path";
    icon = "a-keys-path";
    desktopName = "a-keys-path";
    comment = "A game where you build your way with your keys";
    genericName = "A Key's Path";
    categories = [ "Game" ];
  };

  buildPhase = ''
    runHook preBuild

    # Link the export-templates to the expected location. The --export commands
    # expects the template-file at .../templates/3.2.3.stable/linux_x11_64_release
    # with 3.2.3 being the version of godot.
    mkdir -p $HOME/.local/share/godot
    ln -s ${godot3-export-templates}/share/godot/templates $HOME/.local/share/godot

    # export_presets.cfg copied here as it is .gitignored in source
    # created by godot editor (godot3 -e) Project > Export... and add Linux
    cp ${./export_presets.cfg} export_presets.cfg

    mkdir -p $out/share/a-keys-path
    godot3-headless --export "Linux" $out/share/a-keys-path/a-keys-path

    runHook postBuild
  '';

  installPhase = ''
    runHook preInstall

    mkdir -p $out/bin
    ln -s $out/share/a-keys-path/a-keys-path $out/bin

    # Patch binaries.
    interpreter=$(cat $NIX_CC/nix-support/dynamic-linker)
    patchelf \
      --set-interpreter $interpreter \
      --set-rpath ${lib.makeLibraryPath finalAttrs.buildInputs} \
      $out/share/a-keys-path/a-keys-path

    mkdir -p $out/share/pixmaps
    cp icon.png $out/share/pixmaps/a-keys-path.png

    install -Dm644 ${finalAttrs.desktopItem}/share/applications/a-keys-path.desktop \
      $out/share/applications/a-keys-path.desktop

    runHook postInstall
  '';

  runtimeDependencies = map lib.getLib [
    alsa-lib
  ];

  meta = {
    homepage = "https://geegaz.itch.io/out-of-controls";
    description = "Short puzzle-platformer game made with Godot, running on GLES 2.0";
    mainProgram = "a-keys-path";
    license = with lib.licenses; [
      gpl3Only
      cc-by-sa-40
      cc0
    ];
    platforms = [ "x86_64-linux" ];
    maintainers = with lib.maintainers; [ phanirithvij ];
  };
})