Merge pull request #216416 from atorres1985-contrib/2048-cli

2048-cli: new package
This commit is contained in:
Anderson Torres 2023-02-20 21:27:44 -03:00 committed by GitHub
commit ffd92dde5b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 65 additions and 0 deletions

View file

@ -0,0 +1,61 @@
{ lib
, stdenv
, fetchFromGitHub
, gettext
, installShellFiles
, ncurses
, ui ? "terminal"
}:
assert lib.elem ui [ "terminal" "curses" ];
stdenv.mkDerivation (self: {
pname = "2048-cli";
version = "unstable-2019-12-10";
src = fetchFromGitHub {
owner = "tiehuis";
repo = "2048-cli";
rev = "67439255df7d4f70209ca628d65128cd41d33e8d";
hash = "sha256-U7g2wCZgR7Lp/69ktQIZZ1cScll2baCequemTl3Mc3I=";
};
postPatch = ''
substituteInPlace Makefile \
--replace "-lcurses" "-lncurses"
'';
nativeBuildInputs = [
installShellFiles
];
buildInputs = [
gettext
]
++ (lib.optional (ui == "curses") ncurses);
dontConfigure = true;
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
installManPage man/2048.6
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;
};
})

View file

@ -34808,6 +34808,10 @@ with pkgs;
_1oom = callPackage ../games/1oom { };
_2048-cli = _2048-cli-terminal;
_2048-cli-curses = callPackage ../games/2048-cli { ui = "curses"; };
_2048-cli-terminal = callPackage ../games/2048-cli { ui = "terminal"; };
_2048-in-terminal = callPackage ../games/2048-in-terminal { };
_20kly = callPackage ../games/20kly { };