diff --git a/flake.nix b/flake.nix index 326f828..8e0c895 100644 --- a/flake.nix +++ b/flake.nix @@ -323,8 +323,6 @@ }; }; - packages.gamja = pkgs.compressAll pkgs.gamja; - devShells.default = pkgs.mkShellNoCC { packages = [ pkgs.rage diff --git a/hosts/vno1-oh2/configuration.nix b/hosts/vno1-oh2/configuration.nix index a590852..4efd83f 100644 --- a/hosts/vno1-oh2/configuration.nix +++ b/hosts/vno1-oh2/configuration.nix @@ -299,20 +299,20 @@ redir https://jakstys.lt ''; "irc.jakstys.lt".extraConfig = let - gamja = pkgs.gamja.override { + gamja = pkgs.compressAll (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 - root * ${pkgs.compressAll gamja} + root * ${gamja} file_server browse { precompressed br gzip } diff --git a/modules/services/gitea/default.nix b/modules/services/gitea/default.nix index aa01811..d05e002 100644 --- a/modules/services/gitea/default.nix +++ b/modules/services/gitea/default.nix @@ -78,7 +78,7 @@ route /static/assets/* { uri strip_prefix /static/assets file_server * { - root ${pkgs.compressAll pkgs.gitea.data}/public + root ${pkgs.compressAll pkgs.gitea.data {}}/public precompressed br gzip } } diff --git a/pkgs/compress-all.nix b/pkgs/compress-all.nix index f12eb78..f3bd9d7 100644 --- a/pkgs/compress-all.nix +++ b/pkgs/compress-all.nix @@ -58,14 +58,14 @@ This feature is also available in nginx via `ngx_brotli` and Inputs: -- extensions :: [String] +- formats :: [String] The default list of file extensions to compress. Default: common formats that compress well. The list may be appended (but not reduced) without warning. -- extraExtensions :: [String] +- extraFormats :: [String] Extra extensions to compress in addition to `extensions`. @@ -98,10 +98,12 @@ Inputs: brotli, xz, zstd, - extensions ? ["css" "js" "svg" "ttf" "eot" "txt" "xml" "map" "html" "json" "webmanifest"], - extraExtensions ? [], +}: drv: { + formats ? ["css" "js" "svg" "ttf" "eot" "txt" "xml" "map" "html" "json" "webmanifest"], + extraFormats ? [], compressors ? ["gz" "br"], -} @ args: drv: let + ... +} @ args: let compressorMap = { compressor-gz = "${zopfli}/bin/zopfli --keep {}"; @@ -116,13 +118,13 @@ Inputs: prog = builtins.getAttr "compressor-${ext}" compressorMap; in "tee >(xargs -I{} -n1 -P$NIX_BUILD_CORES ${prog})") compressors; - extensionsVbar = builtins.concatStringsSep "|" (extensions ++ extraExtensions); + formatsbar = builtins.concatStringsSep "|" (formats ++ extraFormats); in runCommand "${drv.name}-compressed" {} '' mkdir $out ${xorg.lndir}/bin/lndir ${drv}/ $out/ find -L $out -type f -regextype posix-extended \ - -iregex '.*\.(${extensionsVbar})' | \ + -iregex '.*\.(${formatsbar})' | \ ${builtins.concatStringsSep " | \\\n " compressCommands} ''