1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
{
lib,
buildGoModule,
buildNpmPackage,
fetchFromGitHub,
pkg-config,
libGL,
libX11,
libXcursor,
libXrandr,
libXinerama,
libXi,
libXxf86vm,
mupdf,
fontconfig,
freetype,
stdenv,
darwin,
}:
buildGoModule rec {
pname = "gcs";
version = "5.21.0";
src = fetchFromGitHub {
owner = "richardwilkes";
repo = "gcs";
rev = "v${version}";
hash = "sha256-mes1aXh4R1re4sW3xYDWtSIcW7lwkWoAxbcbdyT/W+o=";
};
modPostBuild = ''
chmod +w vendor/github.com/richardwilkes/pdf
sed -i 's|-lmupdf[^ ]* |-lmupdf |g' vendor/github.com/richardwilkes/pdf/pdf.go
'';
vendorHash = "sha256-H5GCrrqmDwpCneXawu7kZsRfrQ8hcsbqhpAAG6FCawg=";
frontend = buildNpmPackage {
name = "${pname}-${version}-frontend";
inherit src;
sourceRoot = "${src.name}/server/frontend";
npmDepsHash = "sha256-wP6sjdcjljzmTs0GUMbF2BPo83LKpfdn15sUuMEIn6E=";
installPhase = ''
runHook preInstall
mkdir -p $out
cp -r dist $out/dist
runHook postInstall
'';
};
postPatch = ''
cp -r ${frontend}/dist server/frontend/dist
'';
nativeBuildInputs = [ pkg-config ];
buildInputs =
[
libGL
libX11
libXcursor
libXrandr
libXinerama
libXi
libXxf86vm
mupdf
fontconfig
freetype
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
darwin.apple_sdk_11_0.frameworks.Carbon
darwin.apple_sdk_11_0.frameworks.Cocoa
darwin.apple_sdk_11_0.frameworks.Kernel
];
# flags are based on https://github.com/richardwilkes/gcs/blob/master/build.sh
flags = [ "-a" ];
ldflags = [
"-s"
"-w"
"-X github.com/richardwilkes/toolbox/cmdline.AppVersion=${version}"
];
installPhase = ''
runHook preInstall
install -Dm755 $GOPATH/bin/gcs -t $out/bin
runHook postInstall
'';
meta = {
changelog = "https://github.com/richardwilkes/gcs/releases/tag/${src.rev}";
description = "Stand-alone, interactive, character sheet editor for the GURPS 4th Edition roleplaying game system";
homepage = "https://gurpscharactersheet.com/";
license = lib.licenses.mpl20;
mainProgram = "gcs";
maintainers = with lib.maintainers; [ tomasajt ];
platforms = lib.platforms.linux ++ lib.platforms.darwin;
# incompatible vendor/github.com/richardwilkes/unison/internal/skia/libskia_linux.a
broken = stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64;
};
}
|