Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 bison,
6 flex,
7 pcre2,
8 libunistring,
9 ncurses,
10}:
11
12stdenv.mkDerivation rec {
13 pname = "boxes";
14 version = "2.3.1";
15
16 src = fetchFromGitHub {
17 owner = "ascii-boxes";
18 repo = "boxes";
19 rev = "v${version}";
20 hash = "sha256-dvhb5KWBQt7g4n0ZTQMcJQljIfavV3g8i+P3PWB6Gwk=";
21 };
22
23 # Building instructions:
24 # https://boxes.thomasjensen.com/build.html#building-on-linux--unix
25 nativeBuildInputs = [
26 bison
27 flex
28 ];
29
30 buildInputs = [
31 pcre2
32 libunistring
33 ncurses
34 ];
35
36 dontConfigure = true;
37
38 # Makefile references a system wide config file in '/usr/share'. Instead, we
39 # move it within the store by default.
40 preBuild = ''
41 substituteInPlace Makefile \
42 --replace-fail "GLOBALCONF = /usr/share/boxes" \
43 "GLOBALCONF=${placeholder "out"}/share/boxes/boxes-config"
44 '';
45
46 makeFlags = [ "CC=${stdenv.cc.targetPrefix}cc" ];
47
48 installPhase = ''
49 install -Dm755 -t $out/bin out/boxes
50 install -Dm644 -t $out/share/boxes boxes-config
51 install -Dm644 -t $out/share/man/man1 doc/boxes.1
52 '';
53
54 meta = with lib; {
55 description = "Command line program which draws, removes, and repairs ASCII art boxes";
56 mainProgram = "boxes";
57 homepage = "https://boxes.thomasjensen.com";
58 license = licenses.gpl2Plus;
59 maintainers = with maintainers; [ waiting-for-dev ];
60 platforms = platforms.unix;
61 };
62}