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,
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 = {
boot = {
enable = true;
@ -307,7 +298,16 @@ in {
"www.jakstys.lt".extraConfig = ''
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}
abort @denied
tls {$CREDENTIALS_DIRECTORY}/irc.jakstys.lt-cert.pem {$CREDENTIALS_DIRECTORY}/irc.jakstys.lt-key.pem

View File

@ -1,20 +1,20 @@
{
lib,
gamja,
stdenvNoCC,
fetchFromSourcehut,
buildNpmPackage,
runCommand,
python3,
writeText,
brotli,
zopfli,
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,
}:
buildNpmPackage rec {
pname = "gamja";
}: let
version = "1.0.0-beta.9";
pkg = buildNpmPackage rec {
pname = "gamja";
inherit version;
src = fetchFromSourcehut {
owner = "~emersion";
@ -25,24 +25,28 @@ buildNpmPackage rec {
npmDepsHash = "sha256-LxShwZacCctKAfMNCUMyrSaI1hIVN80Wseq/d8WITkc=";
# without this, the aarch64-linux build fails
nativeBuildInputs = [python3];
installPhase = ''
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 = ''
runHook preInstall
cp -r dist $out
${lib.optionalString (gamjaConfig != null) "cp ${writeText "gamja-config" (builtins.toJSON gamjaConfig)} $out/config.json"}
mv gamja-${version} $out
runHook postInstall
'';
passthru = {
data-compressed =
runCommand "gamja-compressed" {
} ''
data-compressed = runCommand "gamja-compressed" {} ''
mkdir $out
${xorg.lndir}/bin/lndir ${gamja}/ $out/
${xorg.lndir}/bin/lndir ${pkg}/ $out/
find $out \
-name '*.css' -or \