summaryrefslogtreecommitdiffstats
path: root/nixos/modules/services/web-apps
diff options
context:
space:
mode:
authortoastal <toastal@posteo.net>2024-03-18 15:49:41 +0700
committertoastal <toastal@posteo.net>2024-04-11 23:26:11 +0700
commit64b110589cf76e4eaa6ff1c79b162418cccae3a4 (patch)
tree9fe85196f65e324034e55b3c1930c122b173c6b3 /nixos/modules/services/web-apps
parentfcc7c53e9c833a9ee40b790c62bcbc0543170d50 (diff)
movim: minifyStaticFiles prop
Diffstat (limited to 'nixos/modules/services/web-apps')
-rw-r--r--nixos/modules/services/web-apps/movim.nix57
1 files changed, 52 insertions, 5 deletions
diff --git a/nixos/modules/services/web-apps/movim.nix b/nixos/modules/services/web-apps/movim.nix
index c9314e28e949..d7f6ad5bb5ef 100644
--- a/nixos/modules/services/web-apps/movim.nix
+++ b/nixos/modules/services/web-apps/movim.nix
@@ -44,11 +44,17 @@ let
package =
let
- p = cfg.package.override {
- inherit phpCfg;
- withPgsql = cfg.database.type == "pgsql";
- withMysql = cfg.database.type == "mysql";
- };
+ p = cfg.package.override
+ ({
+ inherit phpCfg;
+ withPgsql = cfg.database.type == "pgsql";
+ withMysql = cfg.database.type == "mysql";
+ inherit (cfg) minifyStaticFiles;
+ } // lib.optionalAttrs (lib.isAttrs cfg.minifyStaticFiles) (with cfg.minifyStaticFiles; {
+ esbuild = esbuild.package;
+ lightningcss = lightningcss.package;
+ scour = scour.package;
+ }));
in
p.overrideAttrs (finalAttrs: prevAttrs:
let
@@ -177,6 +183,47 @@ in
description = "Verbose logs.";
};
+ minifyStaticFiles = mkOption {
+ type = with types; either bool (submodule {
+ options = {
+ script = mkOption {
+ type = types.submodule {
+ options = {
+ enable = mkEnableOption "Script minification";
+ package = mkPackageOption pkgs "esbuild" { };
+ target = mkOption {
+ type = with types; nullOr nonEmptyStr;
+ default = null;
+ };
+ };
+ };
+ };
+ style = mkOption {
+ type = types.submodule {
+ options = {
+ enable = mkEnableOption "Script minification";
+ package = mkPackageOption pkgs "lightningcss" { };
+ target = mkOption {
+ type = with types; nullOr nonEmptyStr;
+ default = null;
+ };
+ };
+ };
+ };
+ svg = mkOption {
+ type = types.submodule {
+ options = {
+ enable = mkEnableOption "SVG minification";
+ package = mkPackageOption pkgs "scour" { };
+ };
+ };
+ };
+ };
+ });
+ default = true;
+ description = "Do minification on public static files";
+ };
+
podConfig = mkOption {
type = types.submodule {
options = {