From 6a2805234bbff2d37c1025983c7e29c4b6d54aad Mon Sep 17 00:00:00 2001 From: wxt <3264117476@qq.com> Date: Mon, 25 Nov 2024 14:46:48 +0800 Subject: [PATCH] apache-answer: init at 1.4.1 --- pkgs/by-name/ap/apache-answer/package.nix | 79 +++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 pkgs/by-name/ap/apache-answer/package.nix diff --git a/pkgs/by-name/ap/apache-answer/package.nix b/pkgs/by-name/ap/apache-answer/package.nix new file mode 100644 index 000000000000..20c446c38ba4 --- /dev/null +++ b/pkgs/by-name/ap/apache-answer/package.nix @@ -0,0 +1,79 @@ +{ + buildGoModule, + lib, + fetchFromGitHub, + pnpm, + nodejs, + fetchpatch, + stdenv, +}: + +buildGoModule rec { + pname = "apache-answer"; + version = "1.4.1"; + + src = fetchFromGitHub { + owner = "apache"; + repo = "incubator-answer"; + rev = "refs/tags/v${version}"; + hash = "sha256-nS3ZDwY221axzo1HAz369f5jWZ/mpCn4r3OPPqjiohI="; + }; + + webui = stdenv.mkDerivation { + pname = pname + "-webui"; + inherit version src; + + sourceRoot = "${src.name}/ui"; + + pnpmDeps = pnpm.fetchDeps { + inherit src version pname; + sourceRoot = "${src.name}/ui"; + hash = "sha256-/se6IWeHdazqS7PzOpgtT4IxCJ1WptqBzZ/BdmGb4BA="; + }; + + nativeBuildInputs = [ + pnpm.configHook + nodejs + ]; + + buildPhase = '' + runHook preBuild + + pnpm build + + runHook postBuild + ''; + + installPhase = '' + runHook preInstall + + mkdir -p $out + cp -r build/* $out + + runHook postInstall + ''; + }; + + vendorHash = "sha256-nvXr1YAqVCyhCgPtABTOtzDH+FCQhN9kSEhxKw7ipsE="; + + preBuild = '' + cp -r ${webui}/* ui/build/ + ''; + + patches = [ + (fetchpatch { + url = "https://github.com/apache/incubator-answer/commit/57b0d0e84dd0e0bf3c8a05a38a7f55eddc5f0dda.patch"; + hash = "sha256-TfF+PtrcMYYgNjgU4lGpnshdII8xECTT2L7M26uebn0="; + }) + ]; + + meta = { + homepage = "https://answer.apache.org/"; + license = lib.licenses.asl20; + maintainers = with lib.maintainers; [ bot-wxt1221 ]; + platforms = lib.platforms.unix; + mainProgram = "answer"; + changelog = "https://github.com/apache/incubator-answer/releases/tag/v${version}"; + description = "Q&A platform software for teams at any scales"; + }; +}