0
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-07-14 06:00:33 +03:00

anubis: split xess derivation into a separate package

Unfortunately, because the Xess file needs to be pre-processed and
consumed by the final derivation, it couldn't be overridden if it was
written in-line. This commit splits it into a separate `anubis-xess`
package that can be overridden/overlayed.

This also adds myself as a maintainer for Anubis, and removes the
`nix-update-script` call, since it was never necessary (because Anubis
is hosted on GitHub), stopped working after e049c438a9,
and it certainly won't work now. It also corrects the homepage URL.

Signed-off-by: Fernando Rodrigues <alpha@sigmasquadron.net>
This commit is contained in:
Fernando Rodrigues 2025-05-07 10:03:56 -03:00
parent 5a1b4e070b
commit 89f79ced47
No known key found for this signature in database
GPG key ID: CC3AE2EA00000000
2 changed files with 44 additions and 33 deletions

View file

@ -0,0 +1,35 @@
{ buildNpmPackage, anubis }:
buildNpmPackage {
pname = "${anubis.pname}-xess";
inherit (anubis) version src;
npmDepsHash = "sha256-hTKTTBmfMGv6I+4YbWrOt6F+qD6ysVYi+DEC1konBFk=";
buildPhase = ''
runHook preBuild
npx postcss ./xess/xess.css -o xess.min.css
runHook postBuild
'';
installPhase = ''
runHook preInstall
install -Dm644 xess.min.css $out/xess.min.css
runHook postInstall
'';
meta = anubis.meta // {
description = "Xess files for Anubis";
longDescription = ''
This package is consumed by the main `anubis` package to render the final
styling for the bot check page.
**It is not supposed to be used as a standalone package**, and it exists to
ensure Anubis' styling is override-able by downstreams.
'';
};
}

View file

@ -1,50 +1,28 @@
{
lib,
buildGoModule,
buildNpmPackage,
fetchFromGitHub,
nix-update-script,
nixosTests,
stdenv,
anubis-xess,
esbuild,
brotli,
zstd,
}:
let
buildGoModule (finalAttrs: {
pname = "anubis";
version = "1.18.0";
src = fetchFromGitHub {
owner = "TecharoHQ";
repo = "anubis";
tag = "v${version}";
tag = "v${finalAttrs.version}";
hash = "sha256-grtzkNxgShbldjm+lnANbKVhkUrbwseAT1NaBL85mHg=";
};
anubisXess = buildNpmPackage {
inherit version src;
pname = "${pname}-xess";
npmDepsHash = "sha256-hTKTTBmfMGv6I+4YbWrOt6F+qD6ysVYi+DEC1konBFk=";
buildPhase = ''
runHook preBuild
npx postcss ./xess/xess.css -o xess.min.css
runHook postBuild
'';
installPhase = ''
runHook preInstall
mkdir -p $out
cp xess.min.css $out
runHook postInstall
'';
};
in
buildGoModule (finalAttrs: {
inherit pname version src;
vendorHash = "sha256-EOT/sdVINj9oO1jZHPYB3jQ+XApf9eCUKuMY0tV+vpg=";
nativeBuildInputs = [
@ -72,27 +50,25 @@ buildGoModule (finalAttrs: {
'';
preBuild = ''
go generate ./... && ./web/build.sh && cp -r ${anubisXess}/xess.min.css ./xess
go generate ./... && ./web/build.sh && cp -r ${anubis-xess}/xess.min.css ./xess
'';
preCheck = ''
export DONT_USE_NETWORK=1
'';
passthru = {
tests = { inherit (nixosTests) anubis; };
updateScript = nix-update-script { };
};
passthru.tests = { inherit (nixosTests) anubis; };
meta = {
description = "Weighs the soul of incoming HTTP requests using proof-of-work to stop AI crawlers";
homepage = "https://github.com/TecharoHQ/anubis/";
homepage = "https://anubis.techaro.lol/";
changelog = "https://github.com/TecharoHQ/anubis/releases/tag/v${finalAttrs.version}";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [
knightpp
soopyc
ryand56
sigmasquadron
];
mainProgram = "anubis";
};