Files
nix/packages/comentario/default.nix
Nikolaos Karaolidis a75875a311 Update
Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
2025-10-06 12:03:06 +00:00

77 lines
1.8 KiB
Nix

{ pkgs, ... }:
# AUTO-UPDATE: nix-update --flake comentario --version=branch=dev --subpackage frontend
pkgs.buildGo125Module (finalAttrs: {
pname = "comentario";
version = "3.14.0-unstable-2025-10-03";
src = pkgs.fetchFromGitLab {
owner = "comentario";
repo = "comentario";
# FIXME: Stable rev once type error is fixed
rev = "4f493bb2a8cfe6f72dea8aeb3c13671e90c667dc";
hash = "sha256-L1QcDgjWin7DT3XMyTAMl4f8hnC5d7inemzBLFMppi0=";
};
patches = [ ./superuser-claim.patch ];
vendorHash = "sha256-tnnSJN3CEDbuj4/B0PBwpYCdm3SOgSbvC7htS9+9pr4=";
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-dYk85+e9C0yHZ9jYgsefStZfyQFZZku+Z4Kn7bN4Qjw=";
};
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
cp -r $GOPATH/bin/comentario $out/bin/${finalAttrs.pname}
wrapProgram $out/bin/${finalAttrs.pname} \
--add-flags "--static-path=${finalAttrs.frontend}"
'';
meta.mainProgram = finalAttrs.pname;
})