Merge pull request #307130 from toastal/movim-no-parallel
movim: include authentication patch & remove parallel dependency
This commit is contained in:
commit
368b2d71b4
|
@ -103,22 +103,20 @@ let
|
||||||
lib.concatStringsSep "\n" [
|
lib.concatStringsSep "\n" [
|
||||||
(lib.optionalString brotli.enable ''
|
(lib.optionalString brotli.enable ''
|
||||||
echo -n "Precompressing static files with Brotli …"
|
echo -n "Precompressing static files with Brotli …"
|
||||||
find ${appDir}/public -type f ${findTextFileNames} \
|
find ${appDir}/public -type f ${findTextFileNames} -print0 \
|
||||||
| ${lib.getExe pkgs.parallel} ${lib.escapeShellArgs [
|
| xargs -0 -n 1 -P $NIX_BUILD_CORES ${pkgs.writeShellScript "movim_precompress_broti" ''
|
||||||
"--will-cite"
|
file="$1"
|
||||||
"-j $NIX_BUILD_CORES"
|
${lib.getExe brotli.package} --keep --quality=${builtins.toString brotli.compressionLevel} --output=$file.br $file
|
||||||
"${lib.getExe brotli.package} --keep --quality=${builtins.toString brotli.compressionLevel} --output={}.br {}"
|
''}
|
||||||
]}
|
|
||||||
echo " done."
|
echo " done."
|
||||||
'')
|
'')
|
||||||
(lib.optionalString gzip.enable ''
|
(lib.optionalString gzip.enable ''
|
||||||
echo -n "Precompressing static files with Gzip …"
|
echo -n "Precompressing static files with Gzip …"
|
||||||
find ${appDir}/public -type f ${findTextFileNames} \
|
find ${appDir}/public -type f ${findTextFileNames} -print0 \
|
||||||
| ${lib.getExe pkgs.parallel} ${lib.escapeShellArgs [
|
| xargs -0 -n 1 -P $NIX_BUILD_CORES ${pkgs.writeShellScript "movim_precompress_broti" ''
|
||||||
"--will-cite"
|
file="$1"
|
||||||
"-j $NIX_BUILD_CORES"
|
${lib.getExe gzip.package} -c -${builtins.toString gzip.compressionLevel} $file > $file.gz
|
||||||
"${lib.getExe gzip.package} -c -${builtins.toString gzip.compressionLevel} {} > {}.gz"
|
''}
|
||||||
]}
|
|
||||||
echo " done."
|
echo " done."
|
||||||
'')
|
'')
|
||||||
];
|
];
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
{ lib
|
{ lib
|
||||||
, fetchpatch
|
, fetchpatch
|
||||||
, fetchFromGitHub
|
, fetchFromGitHub
|
||||||
|
, writeShellScript
|
||||||
, dash
|
, dash
|
||||||
, php
|
, php
|
||||||
, phpCfg ? null
|
, phpCfg ? null
|
||||||
, withPgsql ? true # “strongly recommended” according to docs
|
, withPgsql ? true # “strongly recommended” according to docs
|
||||||
, withMysql ? false
|
, withMysql ? false
|
||||||
, minifyStaticFiles ? false # default files are often not minified
|
, minifyStaticFiles ? false # default files are often not minified
|
||||||
, parallel
|
|
||||||
, esbuild
|
, esbuild
|
||||||
, lightningcss
|
, lightningcss
|
||||||
, scour
|
, scour
|
||||||
|
@ -48,6 +48,13 @@ php.buildComposerProject (finalAttrs: {
|
||||||
hash = "sha256-t63POjywZLk5ulppuCedFhhEhOsnB90vy3k/HhM3MGc=";
|
hash = "sha256-t63POjywZLk5ulppuCedFhhEhOsnB90vy3k/HhM3MGc=";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
patches = [
|
||||||
|
(fetchpatch {
|
||||||
|
url = "https://github.com/movim/movim/commit/4dd2842f4617f3baaa166157892a532ad07df80d.patch";
|
||||||
|
hash = "sha256-32MLS5g60Rhm8HQDBPnUo9k+aB7L8dNMcnSjPIlooks=";
|
||||||
|
})
|
||||||
|
];
|
||||||
|
|
||||||
php = php.buildEnv ({
|
php = php.buildEnv ({
|
||||||
extensions = ({ all, enabled }:
|
extensions = ({ all, enabled }:
|
||||||
enabled
|
enabled
|
||||||
|
@ -60,8 +67,7 @@ php.buildComposerProject (finalAttrs: {
|
||||||
});
|
});
|
||||||
|
|
||||||
nativeBuildInputs =
|
nativeBuildInputs =
|
||||||
lib.optional (lib.any (x: x.enable) (lib.attrValues minify)) parallel
|
lib.optional minify.script.enable esbuild
|
||||||
++ lib.optional minify.script.enable esbuild
|
|
||||||
++ lib.optional minify.style.enable lightningcss
|
++ lib.optional minify.style.enable lightningcss
|
||||||
++ lib.optional minify.svg.enable scour;
|
++ lib.optional minify.svg.enable scour;
|
||||||
|
|
||||||
|
@ -94,39 +100,30 @@ php.buildComposerProject (finalAttrs: {
|
||||||
'';
|
'';
|
||||||
|
|
||||||
preBuild = lib.optionalString minify.script.enable ''
|
preBuild = lib.optionalString minify.script.enable ''
|
||||||
find ./public -type f -iname "*.js" \
|
find ./public -type f -iname "*.js" -print0 \
|
||||||
| parallel ${lib.escapeShellArgs [
|
| xargs -0 -n 1 -P $NIX_BUILD_CORES ${writeShellScript "movim_script_minify" ''
|
||||||
"--will-cite"
|
file="$1"
|
||||||
"-j $NIX_BUILD_CORES"
|
tmp="$(mktemp)"
|
||||||
''
|
esbuild $file --minify --target=${lib.escapeShellArg minify.script.target} --outfile=$tmp
|
||||||
tmp="$(mktemp)"
|
[[ "$(stat -c %s $tmp)" -lt "$(stat -c %s $file)" ]] && mv $tmp $file
|
||||||
esbuild {} --minify --target=${lib.escapeShellArg minify.script.target} --outfile=$tmp
|
''}
|
||||||
[[ "$(stat -c %s $tmp)" -lt "$(stat -c %s {})" ]] && mv $tmp {}
|
|
||||||
''
|
|
||||||
]}
|
|
||||||
'' + lib.optionalString minify.style.enable ''
|
'' + lib.optionalString minify.style.enable ''
|
||||||
export BROWSERLIST=${lib.escapeShellArg minify.style.browserslist}
|
find ./public -type f -iname "*.css" -print0 \
|
||||||
find ./public -type f -iname "*.css" \
|
| xargs -0 -n 1 -P $NIX_BUILD_CORES ${writeShellScript "movim_style_minify" ''
|
||||||
| parallel ${lib.escapeShellArgs [
|
export BROWSERLIST="${lib.escapeShellArg minify.style.browserslist}"
|
||||||
"--will-cite"
|
file="$1"
|
||||||
"-j $NIX_BUILD_CORES"
|
tmp="$(mktemp)"
|
||||||
''
|
lightningcss $file --minify --browserslist --output-file=$tmp
|
||||||
tmp="$(mktemp)"
|
[[ "$(stat -c %s $tmp)" -lt "$(stat -c %s $file)" ]] && mv $tmp $file
|
||||||
lightningcss {} --minify --browserslist --output-file=$tmp
|
''}
|
||||||
[[ "$(stat -c %s $tmp)" -lt "$(stat -c %s {})" ]] && mv $tmp {}
|
|
||||||
''
|
|
||||||
]}
|
|
||||||
'' + lib.optionalString minify.svg.enable ''
|
'' + lib.optionalString minify.svg.enable ''
|
||||||
find ./public -type f -iname "*.svg" -a -not -path "*/emojis/*" \
|
find ./public -type f -iname "*.svg" -a -not -path "*/emojis/*" -print0 \
|
||||||
| parallel ${lib.escapeShellArgs [
|
| xargs -0 -n 1 -P $NIX_BUILD_CORES ${writeShellScript "movim_svg_minify" ''
|
||||||
"--will-cite"
|
file="$1"
|
||||||
"-j $NIX_BUILD_CORES"
|
tmp="$(mktemp)"
|
||||||
''
|
scour -i $file -o $tmp --disable-style-to-xml --enable-comment-stripping --enable-viewboxing --indent=tab
|
||||||
tmp="$(mktemp)"
|
[[ "$(stat -c %s $tmp)" -lt "$(stat -c %s $file)" ]] && mv $tmp $file
|
||||||
scour -i {} -o $tmp --disable-style-to-xml --enable-comment-stripping --enable-viewboxing --indent=tab
|
''}
|
||||||
[[ "$(stat -c %s $tmp)" -lt "$(stat -c %s {})" ]] && mv $tmp {}
|
|
||||||
''
|
|
||||||
]}
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
postInstall = ''
|
postInstall = ''
|
||||||
|
|
Loading…
Reference in New Issue
Block a user