nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchfossil,
5 tcl,
6
7 enableTcl ? true,
8}:
9
10stdenv.mkDerivation {
11 pname = "pikchr";
12 # To update, use the last check-in in https://pikchr.org/home/timeline?r=trunk
13 version = "0-unstable-2025-02-28";
14
15 src = fetchfossil {
16 url = "https://pikchr.org/home";
17 rev = "b7fbd56c4eb82ab9";
18 hash = "sha256-7oW1IYYk3YKPjOUPP6qYIdR0oGo9pRDDlyu30J4B3bI=";
19 };
20
21 # can't open generated html files
22 postPatch = ''
23 substituteInPlace Makefile --replace open "test -f"
24 '';
25
26 nativeBuildInputs = lib.optional enableTcl tcl.tclPackageHook;
27
28 buildInputs = lib.optional enableTcl tcl;
29
30 makeFlags = [ "CC=${stdenv.cc.targetPrefix}cc" ];
31
32 buildFlags = [ "pikchr" ] ++ lib.optional enableTcl "piktcl";
33
34 installPhase = ''
35 runHook preInstall
36 install -Dm755 pikchr $out/bin/pikchr
37 install -Dm755 pikchr.out $out/lib/pikchr.o
38 install -Dm644 pikchr.h $out/include/pikchr.h
39 ''
40 + lib.optionalString enableTcl ''
41 cp -r piktcl $out/lib/piktcl
42 ''
43 + ''
44 runHook postInstall
45 '';
46
47 dontWrapTclBinaries = true;
48
49 doCheck = true;
50
51 meta = with lib; {
52 description = "PIC-like markup language for diagrams in technical documentation";
53 homepage = "https://pikchr.org";
54 license = licenses.bsd0;
55 maintainers = with maintainers; [ fgaz ];
56 platforms = platforms.all;
57 mainProgram = "pikchr";
58 };
59}