extraCompressors

This commit is contained in:
Motiejus Jakštys 2024-02-15 10:57:31 +02:00
parent d2ad87558c
commit d148f04fca
2 changed files with 7 additions and 11 deletions

View File

@ -141,6 +141,10 @@ in {
Default: ["gz" "br"] Default: ["gz" "br"]
- extraCompressors :: [String]
Extra compressors in addition to `compressors`.
- compressor-<COMPRESSOR> :: String - compressor-<COMPRESSOR> :: String
Map a desired extension (e.g. `gz`) to a compress program. Map a desired extension (e.g. `gz`) to a compress program.
@ -154,17 +158,19 @@ in {
compressor-gz = "${zopfli}/bin/zopfli --keep {}"; compressor-gz = "${zopfli}/bin/zopfli --keep {}";
compressor-br = "${brotli}/bin/brotli --keep --no-copy-stat {}"; compressor-br = "${brotli}/bin/brotli --keep --no-copy-stat {}";
*/ */
compressDrvWeb = drv: { compressDrvWeb = drv: {
formats ? ["css" "js" "svg" "ttf" "eot" "txt" "xml" "map" "html" "json" "webmanifest"], formats ? ["css" "js" "svg" "ttf" "eot" "txt" "xml" "map" "html" "json" "webmanifest"],
extraFormats ? [], extraFormats ? [],
compressors ? ["gz" "br"], compressors ? ["gz" "br"],
extraCompressors ? [],
... ...
} @ args: } @ args:
compressDrv drv ({ compressDrv drv ({
formats = formats ++ extraFormats; formats = formats ++ extraFormats;
compressors = compressors; compressors = compressors ++ extraCompressors;
compressor-gz = "${zopfli}/bin/zopfli --keep {}"; compressor-gz = "${zopfli}/bin/zopfli --keep {}";
compressor-br = "${brotli}/bin/brotli --keep --no-copy-stat {}"; compressor-br = "${brotli}/bin/brotli --keep --no-copy-stat {}";
} }

View File

@ -1,11 +1 @@
ignore = ['modules/base/boot'] ignore = ['modules/base/boot']
# If the attrset has an optional field, `inherit` will not inherit it:
# compressDrvWeb = drv: {
# compressors ? ["gz" "br"],
# ...
# } @ args:
# compressDrv drv {
# inherit (compressors) <<- function 'compressDrv' called without required argument 'compressors'
# }
disabled = ["manual_inherit"]