1{
2 buildGoModule,
3 lib,
4 fetchFromGitHub,
5 pnpm_9,
6 nodejs,
7 fetchpatch,
8 stdenv,
9}:
10
11buildGoModule rec {
12 pname = "apache-answer";
13 version = "1.4.1";
14
15 src = fetchFromGitHub {
16 owner = "apache";
17 repo = "incubator-answer";
18 tag = "v${version}";
19 hash = "sha256-nS3ZDwY221axzo1HAz369f5jWZ/mpCn4r3OPPqjiohI=";
20 };
21
22 webui = stdenv.mkDerivation {
23 pname = pname + "-webui";
24 inherit version src;
25
26 sourceRoot = "${src.name}/ui";
27
28 pnpmDeps = pnpm_9.fetchDeps {
29 inherit src version pname;
30 sourceRoot = "${src.name}/ui";
31 fetcherVersion = 1;
32 hash = "sha256-/se6IWeHdazqS7PzOpgtT4IxCJ1WptqBzZ/BdmGb4BA=";
33 };
34
35 nativeBuildInputs = [
36 pnpm_9.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-nvXr1YAqVCyhCgPtABTOtzDH+FCQhN9kSEhxKw7ipsE=";
59
60 preBuild = ''
61 cp -r ${webui}/* ui/build/
62 '';
63
64 patches = [
65 (fetchpatch {
66 url = "https://github.com/apache/incubator-answer/commit/57b0d0e84dd0e0bf3c8a05a38a7f55eddc5f0dda.patch";
67 hash = "sha256-TfF+PtrcMYYgNjgU4lGpnshdII8xECTT2L7M26uebn0=";
68 })
69 ];
70
71 meta = {
72 homepage = "https://answer.apache.org/";
73 license = lib.licenses.asl20;
74 maintainers = with lib.maintainers; [ bot-wxt1221 ];
75 platforms = lib.platforms.unix;
76 mainProgram = "answer";
77 changelog = "https://github.com/apache/incubator-answer/releases/tag/v${version}";
78 description = "Q&A platform software for teams at any scales";
79 };
80}