gitea: create static gzip and brotli files

This commit is contained in:
Izorkin 2023-02-25 09:20:43 +03:00
parent 108d7c1e71
commit 57a7270642
No known key found for this signature in database
GPG Key ID: 1436C1B3F3679F09

View File

@ -5,11 +5,15 @@
, makeWrapper
, git
, bash
, gitea
, gzip
, openssh
, pam
, sqliteSupport ? true
, pamSupport ? true
, runCommand
, brotli
, xorg
, nixosTests
}:
@ -61,7 +65,21 @@ buildGoModule rec {
--prefix PATH : ${lib.makeBinPath [ bash git gzip openssh ]}
'';
passthru.tests = nixosTests.gitea;
passthru = {
data-compressed = runCommand "data-compressed" {
nativeBuildInputs = [ brotli xorg.lndir ];
} ''
mkdir $out
lndir ${gitea.data}/ $out/
# Create static gzip and brotli files
find -L $out -type f -regextype posix-extended -iregex '.*\.(css|html|js|svg|ttf|txt)' \
-exec gzip --best --keep --force {} ';' \
-exec brotli --best --keep --no-copy-stat {} ';'
'';
tests = nixosTests.gitea;
};
meta = with lib; {
description = "Git with a cup of tea";