nixpkgs/pkgs/games/2048-cli/default.nix

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

63 lines
1.2 KiB
Nix
Raw Normal View History

{ lib
, stdenv
, fetchFromGitHub
2023-02-12 18:55:14 +00:00
, gettext
, installShellFiles
, ncurses
, ui ? "terminal"
}:
2023-02-12 18:55:14 +00:00
assert lib.elem ui [ "terminal" "curses" ];
2023-04-16 20:12:31 +00:00
stdenv.mkDerivation (finalAttrs: {
pname = "2048-cli";
2023-02-12 18:55:14 +00:00
version = "unstable-2019-12-10";
src = fetchFromGitHub {
owner = "tiehuis";
repo = "2048-cli";
2023-02-12 18:55:14 +00:00
rev = "67439255df7d4f70209ca628d65128cd41d33e8d";
hash = "sha256-U7g2wCZgR7Lp/69ktQIZZ1cScll2baCequemTl3Mc3I=";
};
postPatch = ''
substituteInPlace Makefile \
--replace "-lcurses" "-lncurses"
'';
nativeBuildInputs = [
installShellFiles
];
2023-02-12 18:55:14 +00:00
buildInputs = [
gettext
]
++ (lib.optional (ui == "curses") ncurses);
dontConfigure = true;
env.NIX_CFLAGS_COMPILE = "-I${lib.getDev gettext}/share/gettext/";
makeFlags = [
"CC=${stdenv.cc.targetPrefix}cc"
ui
];
installPhase = ''
runHook preInstall
install -Dm755 -t $out/bin 2048
2023-02-12 18:55:14 +00:00
installManPage man/2048.6
runHook postInstall
'';
meta = {
homepage = "https://github.com/tiehuis/2048-cli";
description = "Game 2048 for your Linux terminal";
license = lib.licenses.mit;
maintainers = [ lib.maintainers.AndersonTorres ];
platforms = lib.platforms.unix;
mainProgram = "2048";
};
})