at 25.11-pre 65 lines 1.2 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 gettext, 6 installShellFiles, 7 ncurses, 8 ui ? "terminal", 9}: 10 11assert lib.elem ui [ 12 "terminal" 13 "curses" 14]; 15stdenv.mkDerivation (finalAttrs: { 16 pname = "2048-cli"; 17 version = "unstable-2019-12-10"; 18 19 src = fetchFromGitHub { 20 owner = "tiehuis"; 21 repo = "2048-cli"; 22 rev = "67439255df7d4f70209ca628d65128cd41d33e8d"; 23 hash = "sha256-U7g2wCZgR7Lp/69ktQIZZ1cScll2baCequemTl3Mc3I="; 24 }; 25 26 postPatch = '' 27 substituteInPlace Makefile \ 28 --replace "-lcurses" "-lncurses" 29 ''; 30 31 nativeBuildInputs = [ 32 installShellFiles 33 ]; 34 35 buildInputs = [ 36 gettext 37 ] ++ (lib.optional (ui == "curses") ncurses); 38 39 dontConfigure = true; 40 41 env.NIX_CFLAGS_COMPILE = "-I${lib.getDev gettext}/share/gettext/"; 42 43 makeFlags = [ 44 "CC=${stdenv.cc.targetPrefix}cc" 45 ui 46 ]; 47 48 installPhase = '' 49 runHook preInstall 50 51 install -Dm755 -t $out/bin 2048 52 installManPage man/2048.6 53 54 runHook postInstall 55 ''; 56 57 meta = { 58 homepage = "https://github.com/tiehuis/2048-cli"; 59 description = "Game 2048 for your Linux terminal"; 60 license = lib.licenses.mit; 61 maintainers = [ ]; 62 platforms = lib.platforms.unix; 63 mainProgram = "2048"; 64 }; 65})