83 lines
2.1 KiB
Nix
83 lines
2.1 KiB
Nix
{ pkgs, ... }:
|
|
# AUTO-UPDATE: nix-update --flake comentario --version=branch=dev --subpackage frontend
|
|
pkgs.buildGoModule (finalAttrs: {
|
|
pname = "comentario";
|
|
version = "3.14.0-unstable-2025-08-29";
|
|
|
|
src = pkgs.fetchFromGitLab {
|
|
owner = "comentario";
|
|
repo = "comentario";
|
|
# FIXME: Stable rev once type error is fixed
|
|
rev = "90773f976366318389f9d5aa457e6303e6159740";
|
|
hash = "sha256-f0Y+OdbsG8eA2kD17b4QWaL0hAuoF476XtYm/aFOmLY=";
|
|
};
|
|
|
|
patches = [
|
|
# FIXME: https://gitlab.com/comentario/comentario/-/merge_requests/23
|
|
./dynamic-config-env-vars.patch
|
|
];
|
|
|
|
vendorHash = "sha256-IYo1Z7BVTGafsN4gC554S33r7X9Urb1uS4RkOqMYlP0=";
|
|
|
|
nativeBuildInputs = with pkgs; [
|
|
go-swagger
|
|
makeWrapper
|
|
];
|
|
|
|
subPackages = [ "." ];
|
|
|
|
frontend = pkgs.stdenv.mkDerivation (finalFrontendAttrs: {
|
|
inherit (finalAttrs)
|
|
pname
|
|
version
|
|
src
|
|
patches
|
|
;
|
|
|
|
missingHashes = ./missing-hashes.json;
|
|
offlineCache = pkgs.yarn-berry.fetchYarnBerryDeps {
|
|
inherit (finalFrontendAttrs) src patches missingHashes;
|
|
hash = "sha256-bn/PNgk7ZjCzGSj7BQQCB+5RY+ivJGYZa2/GC4eRjPY=";
|
|
};
|
|
|
|
nativeBuildInputs = with pkgs; [
|
|
nodejs
|
|
openapi-generator-cli
|
|
hugo
|
|
yarn-berry
|
|
yarn-berry.yarnBerryConfigHook
|
|
];
|
|
|
|
env = {
|
|
CYPRESS_INSTALL_BINARY = "0";
|
|
YARN_NODE_LINKER = "node-modules";
|
|
};
|
|
|
|
buildPhase = ''
|
|
(cd frontend && openapi-generator-cli generate -i ../resources/swagger/swagger.yml -g typescript-angular -o generated-api)
|
|
yarn run build:prod
|
|
'';
|
|
|
|
installPhase = ''
|
|
cp -r build/frontend $out
|
|
'';
|
|
});
|
|
|
|
preBuild = ''
|
|
go generate
|
|
'';
|
|
|
|
installPhase = ''
|
|
mkdir -p $out/bin $out/lib/${finalAttrs.pname}
|
|
cp -r $GOPATH/bin/comentario $out/bin/${finalAttrs.pname}
|
|
cp -r db templates $out/lib/${finalAttrs.pname}
|
|
|
|
wrapProgram $out/bin/${finalAttrs.pname} \
|
|
--add-flags "--db-migration-path=$out/lib/${finalAttrs.pname}/db" \
|
|
--add-flags "--template-path=$out/lib/${finalAttrs.pname}/templates" \
|
|
--add-flags "--static-path=${finalAttrs.frontend}"
|
|
'';
|
|
|
|
meta.mainProgram = finalAttrs.pname;
|
|
})
|