gamja: pack properly

This commit is contained in:
Motiejus Jakštys 2024-02-12 22:46:27 +02:00
parent dac9650b65
commit b9c73de9ce
2 changed files with 52 additions and 48 deletions

View File

@ -4,16 +4,7 @@
pkgs, pkgs,
myData, myData,
... ...
}: let }: {
# TODO: this doesn't get added to the compressed version
gamja = pkgs.gamja.override {
gamjaConfig = {
server = {
url = "irc.jakstys.lt:6698";
};
};
};
in {
zfs-root = { zfs-root = {
boot = { boot = {
enable = true; enable = true;
@ -307,7 +298,16 @@ in {
"www.jakstys.lt".extraConfig = '' "www.jakstys.lt".extraConfig = ''
redir https://jakstys.lt redir https://jakstys.lt
''; '';
"irc.jakstys.lt".extraConfig = '' "irc.jakstys.lt".extraConfig = let
gamja = pkgs.gamja.override {
gamjaConfig = {
server = {
url = "irc.jakstys.lt:6698";
nick = "motiejus";
};
};
};
in ''
@denied not remote_ip ${myData.subnets.tailscale.cidr} @denied not remote_ip ${myData.subnets.tailscale.cidr}
abort @denied abort @denied
tls {$CREDENTIALS_DIRECTORY}/irc.jakstys.lt-cert.pem {$CREDENTIALS_DIRECTORY}/irc.jakstys.lt-key.pem tls {$CREDENTIALS_DIRECTORY}/irc.jakstys.lt-cert.pem {$CREDENTIALS_DIRECTORY}/irc.jakstys.lt-key.pem

View File

@ -1,20 +1,20 @@
{ {
lib, lib,
gamja, stdenvNoCC,
fetchFromSourcehut, fetchFromSourcehut,
buildNpmPackage, buildNpmPackage,
runCommand, runCommand,
python3,
writeText, writeText,
brotli, brotli,
zopfli, zopfli,
xorg, xorg,
# optional configuration attrSet, see https://git.sr.ht/~emersion/gamja#configuration-file for possible values # https://git.sr.ht/~emersion/gamja/tree/master/doc/config-file.md
gamjaConfig ? null, gamjaConfig ? null,
}: }: let
buildNpmPackage rec {
pname = "gamja";
version = "1.0.0-beta.9"; version = "1.0.0-beta.9";
pkg = buildNpmPackage rec {
pname = "gamja";
inherit version;
src = fetchFromSourcehut { src = fetchFromSourcehut {
owner = "~emersion"; owner = "~emersion";
@ -25,24 +25,28 @@ buildNpmPackage rec {
npmDepsHash = "sha256-LxShwZacCctKAfMNCUMyrSaI1hIVN80Wseq/d8WITkc="; npmDepsHash = "sha256-LxShwZacCctKAfMNCUMyrSaI1hIVN80Wseq/d8WITkc=";
# without this, the aarch64-linux build fails installPhase = ''
nativeBuildInputs = [python3]; mv dist $out
${lib.optionalString (gamjaConfig != null) "cp ${writeText "gamja-config" (builtins.toJSON gamjaConfig)} $out/config.json"}
'';
};
in
stdenvNoCC.mkDerivation {
name = pkg.pname;
inherit (pkg) version;
src = pkg;
sourceRoot = ".";
installPhase = '' installPhase = ''
runHook preInstall runHook preInstall
mv gamja-${version} $out
cp -r dist $out
${lib.optionalString (gamjaConfig != null) "cp ${writeText "gamja-config" (builtins.toJSON gamjaConfig)} $out/config.json"}
runHook postInstall runHook postInstall
''; '';
passthru = { passthru = {
data-compressed = data-compressed = runCommand "gamja-compressed" {} ''
runCommand "gamja-compressed" {
} ''
mkdir $out mkdir $out
${xorg.lndir}/bin/lndir ${gamja}/ $out/ ${xorg.lndir}/bin/lndir ${pkg}/ $out/
find $out \ find $out \
-name '*.css' -or \ -name '*.css' -or \
@ -62,4 +66,4 @@ buildNpmPackage rec {
license = licenses.agpl3Only; license = licenses.agpl3Only;
maintainers = with maintainers; [motiejus]; maintainers = with maintainers; [motiejus];
}; };
} }