1{
2 buildGoModule,
3 lib,
4 fetchFromGitHub,
5 pnpm,
6 nodejs,
7 fetchpatch,
8 stdenv,
9}:
10
11buildGoModule rec {
12 pname = "apache-answer";
13 version = "1.6.0";
14
15 src = fetchFromGitHub {
16 owner = "apache";
17 repo = "answer";
18 tag = "v${version}";
19 hash = "sha256-QrLYkGiEDBB4uUzG2yrlEUYXpQxovKFBmGZjLbZiGKk=";
20 };
21
22 webui = stdenv.mkDerivation {
23 pname = pname + "-webui";
24 inherit version src;
25
26 sourceRoot = "${src.name}/ui";
27
28 pnpmDeps = pnpm.fetchDeps {
29 inherit src version pname;
30 sourceRoot = "${src.name}/ui";
31 fetcherVersion = 1;
32 hash = "sha256-6IeLOwsEqchCwe0GGj/4v9Q4/Hm16K+ve2X+8QHztQM=";
33 };
34
35 nativeBuildInputs = [
36 pnpm.configHook
37 nodejs
38 ];
39
40 buildPhase = ''
41 runHook preBuild
42
43 pnpm build
44
45 runHook postBuild
46 '';
47
48 installPhase = ''
49 runHook preInstall
50
51 mkdir -p $out
52 cp -r build/* $out
53
54 runHook postInstall
55 '';
56 };
57
58 vendorHash = "sha256-mWSKoEYj23fy6ix3mK1/5HeGugp1UAUO+iwInXkzgU4=";
59
60 doCheck = false; # TODO checks are currently broken upstream
61
62 ldflags = [
63 "-X main.Version=${version}"
64 "-X main.Commit=${version}"
65 ];
66
67 preBuild = ''
68 cp -r ${webui}/* ui/build/
69 '';
70
71 meta = {
72 homepage = "https://answer.apache.org/";
73 license = lib.licenses.asl20;
74 maintainers = with lib.maintainers; [
75 bot-wxt1221
76 ];
77 platforms = lib.platforms.unix;
78 mainProgram = "answer";
79 changelog = "https://github.com/apache/answer/releases/tag/v${version}";
80 description = "Q&A platform software for teams at any scales";
81 };
82}