1{ lib, stdenv, fetchFromGitHub, bison, flex }:
2
3stdenv.mkDerivation rec {
4 pname = "boxes";
5 version = "1.3";
6
7 src = fetchFromGitHub {
8 owner = "ascii-boxes";
9 repo = "boxes";
10 rev = "v${version}";
11 sha256 = "0b12rsynrmkldlwcb62drk33kk0aqwbj10mq5y5x3hjf626gjwsi";
12 };
13
14 # Building instructions:
15 # https://boxes.thomasjensen.com/build.html#building-on-linux--unix
16 nativeBuildInputs = [ bison flex ];
17
18 dontConfigure = true;
19
20 # Makefile references a system wide config file in '/usr/share'. Instead, we
21 # move it within the store by default.
22 preBuild = ''
23 substituteInPlace Makefile \
24 --replace "GLOBALCONF = /usr/share/boxes" \
25 "GLOBALCONF=${placeholder "out"}/share/boxes/boxes-config"
26 '';
27
28 makeFlags = [ "CC=${stdenv.cc.targetPrefix}cc" ];
29
30 installPhase = ''
31 install -Dm755 -t $out/bin src/boxes
32 install -Dm644 -t $out/share/boxes boxes-config
33 install -Dm644 -t $out/share/man/man1 doc/boxes.1
34 '';
35
36 meta = with lib; {
37 description = "Command line ASCII boxes unlimited!";
38 longDescription = ''
39 Boxes is a command line filter program that draws ASCII art boxes around
40 your input text.
41 '';
42 homepage = "https://boxes.thomasjensen.com";
43 license = licenses.gpl2;
44 maintainers = with maintainers; [ waiting-for-dev ];
45 platforms = platforms.unix;
46 };
47}