nixpkgs/pkgs/games/oh-my-git/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

135 lines
2.8 KiB
Nix
Raw Normal View History

2021-04-16 18:30:49 +02:00
{ lib
, autoPatchelfHook
2021-04-16 18:30:49 +02:00
, copyDesktopItems
, fetchFromGitHub
, makeDesktopItem
, stdenv
, alsa-lib
2021-04-16 18:30:49 +02:00
, gcc-unwrapped
, git
, godot3-export-templates
, godot3-headless
2021-04-16 18:30:49 +02:00
, libGLU
, libX11
, libXcursor
, libXext
, libXfixes
, libXi
, libXinerama
, libXrandr
, libXrender
, libglvnd
, libpulseaudio
, perl
2021-04-16 18:30:49 +02:00
, zlib
, udev # for libudev
2021-04-16 18:30:49 +02:00
}:
stdenv.mkDerivation rec {
pname = "oh-my-git";
2022-07-21 22:34:39 +02:00
version = "0.6.5";
2021-04-16 18:30:49 +02:00
src = fetchFromGitHub {
owner = "git-learning-game";
repo = "oh-my-git";
rev = version;
2022-07-21 22:34:39 +02:00
sha256 = "sha256-XqxliMVU55D5JSt7Yo5btvZnnTlagSukyhXv6Akgklo=";
2021-04-16 18:30:49 +02:00
};
nativeBuildInputs = [
autoPatchelfHook
2021-04-16 18:30:49 +02:00
copyDesktopItems
godot3-headless
2021-04-16 18:30:49 +02:00
];
buildInputs = [
alsa-lib
2021-04-16 18:30:49 +02:00
gcc-unwrapped.lib
git
libGLU
libX11
libXcursor
libXext
libXfixes
libXi
libXinerama
libXrandr
libXrender
libglvnd
libpulseaudio
perl
2021-04-16 18:30:49 +02:00
zlib
udev
2021-04-16 18:30:49 +02:00
];
desktopItems = [
(makeDesktopItem {
name = "oh-my-git";
exec = "oh-my-git";
icon = "oh-my-git";
desktopName = "oh-my-git";
comment = "An interactive Git learning game!";
genericName = "An interactive Git learning game!";
categories = [ "Game" ];
2021-04-16 18:30:49 +02:00
})
];
# patch shebangs so that e.g. the fake-editor script works:
# error: /usr/bin/env 'perl': No such file or directory
# error: There was a problem with the editor
postPatch = ''
patchShebangs scripts
'';
2021-04-16 18:30:49 +02:00
buildPhase = ''
runHook preBuild
# Cannot create file '/homeless-shelter/.config/godot/projects/...'
export HOME=$TMPDIR
# 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
2021-04-16 18:30:49 +02:00
mkdir -p $out/share/oh-my-git
godot3-headless --export "Linux" $out/share/oh-my-git/oh-my-git
2021-04-16 18:30:49 +02:00
runHook postBuild
'';
installPhase = ''
runHook preInstall
mkdir -p $out/bin
ln -s $out/share/oh-my-git/oh-my-git $out/bin
# Patch binaries.
interpreter=$(cat $NIX_CC/nix-support/dynamic-linker)
patchelf \
--set-interpreter $interpreter \
--set-rpath ${lib.makeLibraryPath buildInputs} \
$out/share/oh-my-git/oh-my-git
mkdir -p $out/share/pixmaps
cp images/oh-my-git.png $out/share/pixmaps/oh-my-git.png
runHook postInstall
'';
runtimeDependencies = map lib.getLib [
alsa-lib
libpulseaudio
udev
];
2021-04-16 18:30:49 +02:00
meta = with lib; {
homepage = "https://ohmygit.org/";
description = "An interactive Git learning game";
license = with licenses; [ blueOak100 ];
platforms = [ "x86_64-linux" ];
maintainers = with maintainers; [ jojosch ];
};
}