diff --git a/hosts/vno1-oh2/configuration.nix b/hosts/vno1-oh2/configuration.nix index 9ac83c7..bab87c4 100644 --- a/hosts/vno1-oh2/configuration.nix +++ b/hosts/vno1-oh2/configuration.nix @@ -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 diff --git a/pkgs/gamja.nix b/pkgs/gamja.nix index 8ef1891..6e017a7 100644 --- a/pkgs/gamja.nix +++ b/pkgs/gamja.nix @@ -1,48 +1,52 @@ { 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"; - repo = "gamja"; - rev = "v${version}"; - hash = "sha256-09rCj9oMzldRrxMGH4rUnQ6wugfhfmJP3rHET5b+NC8="; + src = fetchFromSourcehut { + owner = "~emersion"; + repo = "gamja"; + rev = "v${version}"; + hash = "sha256-09rCj9oMzldRrxMGH4rUnQ6wugfhfmJP3rHET5b+NC8="; + }; + + npmDepsHash = "sha256-LxShwZacCctKAfMNCUMyrSaI1hIVN80Wseq/d8WITkc="; + + 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 = "."; - npmDepsHash = "sha256-LxShwZacCctKAfMNCUMyrSaI1hIVN80Wseq/d8WITkc="; + installPhase = '' + runHook preInstall + mv gamja-${version} $out + runHook postInstall + ''; - # without this, the aarch64-linux build fails - nativeBuildInputs = [python3]; - - installPhase = '' - runHook preInstall - - cp -r dist $out - ${lib.optionalString (gamjaConfig != null) "cp ${writeText "gamja-config" (builtins.toJSON gamjaConfig)} $out/config.json"} - - runHook postInstall - ''; - - passthru = { - data-compressed = - runCommand "gamja-compressed" { - } '' + passthru = { + data-compressed = runCommand "gamja-compressed" {} '' mkdir $out - ${xorg.lndir}/bin/lndir ${gamja}/ $out/ + ${xorg.lndir}/bin/lndir ${pkg}/ $out/ find $out \ -name '*.css' -or \ @@ -54,12 +58,12 @@ buildNpmPackage rec { tee >(xargs -n1 -P''$(nproc) ${zopfli}/bin/zopfli) | \ xargs -n1 -P''$(nproc) ${brotli}/bin/brotli ''; - }; + }; - meta = with lib; { - description = "A simple IRC web client"; - homepage = "https://git.sr.ht/~emersion/gamja"; - license = licenses.agpl3Only; - maintainers = with maintainers; [motiejus]; - }; -} + meta = with lib; { + description = "A simple IRC web client"; + homepage = "https://git.sr.ht/~emersion/gamja"; + license = licenses.agpl3Only; + maintainers = with maintainers; [motiejus]; + }; + }