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