|
| 1 | +# copied from oh-my-git/package.nix by @jojosch (Johannes Schleifenbaum) |
| 2 | +# added in nixos/nixpkgs#119642 |
| 3 | +{ |
| 4 | + lib, |
| 5 | + autoPatchelfHook, |
| 6 | + copyDesktopItems, |
| 7 | + fetchFromGitHub, |
| 8 | + makeDesktopItem, |
| 9 | + stdenv, |
| 10 | + alsa-lib, |
| 11 | + godot3-export-templates, |
| 12 | + godot3-headless, |
| 13 | + libX11, |
| 14 | + libXcursor, |
| 15 | + libXext, |
| 16 | + libXi, |
| 17 | + libXinerama, |
| 18 | + libXrandr, |
| 19 | + libXrender, |
| 20 | + libglvnd, |
| 21 | +}: |
| 22 | +stdenv.mkDerivation (finalAttrs: { |
| 23 | + pname = "a-keys-path"; |
| 24 | + version = "0.7.1"; |
| 25 | + |
| 26 | + src = fetchFromGitHub { |
| 27 | + owner = "geegaz"; |
| 28 | + repo = "A-Key-s-Path"; |
| 29 | + tag = "v${finalAttrs.version}"; |
| 30 | + hash = "sha256-i9INPB883/0fmtZgJpVpsA/7Q51DHOMWvkLF9hKE6gQ="; |
| 31 | + }; |
| 32 | + |
| 33 | + nativeBuildInputs = [ |
| 34 | + autoPatchelfHook |
| 35 | + copyDesktopItems |
| 36 | + godot3-headless |
| 37 | + ]; |
| 38 | + |
| 39 | + buildInputs = [ |
| 40 | + libX11 |
| 41 | + libXcursor |
| 42 | + libXext |
| 43 | + libXi |
| 44 | + libXinerama |
| 45 | + libXrandr |
| 46 | + libXrender |
| 47 | + libglvnd |
| 48 | + ]; |
| 49 | + |
| 50 | + desktopItem = makeDesktopItem { |
| 51 | + name = "a-keys-path"; |
| 52 | + exec = "a-keys-path"; |
| 53 | + icon = "a-keys-path"; |
| 54 | + desktopName = "a-keys-path"; |
| 55 | + comment = "A game where you build your way with your keys"; |
| 56 | + genericName = "A Key's Path"; |
| 57 | + categories = [ "Game" ]; |
| 58 | + }; |
| 59 | + |
| 60 | + buildPhase = '' |
| 61 | + runHook preBuild |
| 62 | +
|
| 63 | + # Cannot create file '/homeless-shelter/.config/godot/projects/...' |
| 64 | + export HOME=$TMPDIR |
| 65 | +
|
| 66 | + # Link the export-templates to the expected location. The --export commands |
| 67 | + # expects the template-file at .../templates/3.2.3.stable/linux_x11_64_release |
| 68 | + # with 3.2.3 being the version of godot. |
| 69 | + mkdir -p $HOME/.local/share/godot |
| 70 | + ln -s ${godot3-export-templates}/share/godot/templates $HOME/.local/share/godot |
| 71 | +
|
| 72 | + # export_presets.cfg copied here as it is .gitignored in source |
| 73 | + # created by godot editor (godot3 -e) Project > Export... and add Linux |
| 74 | + cp ${./export_presets.cfg} export_presets.cfg |
| 75 | +
|
| 76 | + mkdir -p $out/share/a-keys-path |
| 77 | + godot3-headless --export "Linux" $out/share/a-keys-path/a-keys-path |
| 78 | +
|
| 79 | + runHook postBuild |
| 80 | + ''; |
| 81 | + |
| 82 | + installPhase = '' |
| 83 | + runHook preInstall |
| 84 | +
|
| 85 | + mkdir -p $out/bin |
| 86 | + ln -s $out/share/a-keys-path/a-keys-path $out/bin |
| 87 | +
|
| 88 | + # Patch binaries. |
| 89 | + interpreter=$(cat $NIX_CC/nix-support/dynamic-linker) |
| 90 | + patchelf \ |
| 91 | + --set-interpreter $interpreter \ |
| 92 | + --set-rpath ${lib.makeLibraryPath finalAttrs.buildInputs} \ |
| 93 | + $out/share/a-keys-path/a-keys-path |
| 94 | +
|
| 95 | + mkdir -p $out/share/pixmaps |
| 96 | + cp icon.png $out/share/pixmaps/a-keys-path.png |
| 97 | +
|
| 98 | + install -Dm644 ${finalAttrs.desktopItem}/share/applications/a-keys-path.desktop \ |
| 99 | + $out/share/applications/a-keys-path.desktop |
| 100 | +
|
| 101 | + runHook postInstall |
| 102 | + ''; |
| 103 | + |
| 104 | + runtimeDependencies = map lib.getLib [ |
| 105 | + alsa-lib |
| 106 | + ]; |
| 107 | + |
| 108 | + meta = { |
| 109 | + homepage = "https://geegaz.itch.io/out-of-controls"; |
| 110 | + description = "Short puzzle-platformer game made with Godot, running on GLES 2.0"; |
| 111 | + mainProgram = "a-keys-path"; |
| 112 | + license = with lib.licenses; [ |
| 113 | + gpl3Only |
| 114 | + cc-by-sa-40 |
| 115 | + cc0 |
| 116 | + ]; |
| 117 | + platforms = [ "x86_64-linux" ]; |
| 118 | + maintainers = with lib.maintainers; [ phanirithvij ]; |
| 119 | + }; |
| 120 | +}) |
0 commit comments