matomo: Fix consistency check

This is done by recalculating sizes and md5 hashes and inserting them
into the manifest.

Changed files
+22 -7
nixos
modules
services
web-apps
pkgs
servers
web-apps
matomo
-6
nixos/modules/services/web-apps/matomo-doc.xml
···
<itemizedlist>
<listitem>
<para>
-
Matomo's file integrity check will warn you. This is due to the patches
-
necessary for NixOS, you can safely ignore this.
-
</para>
-
</listitem>
-
<listitem>
-
<para>
Matomo will warn you that the JavaScript tracker is not writable. This is
because it's located in the read-only nix store. You can safely ignore
this, unless you need a plugin that needs JavaScript tracker access.
+22 -1
pkgs/servers/web-apps/matomo/default.nix
···
installPhase = ''
runHook preInstall
-
# copy evertything to share/, used as webroot folder, and then remove what's known to be not needed
+
# copy everything to share/, used as webroot folder, and then remove what's known to be not needed
mkdir -p $out/share
cp -ra * $out/share/
# tmp/ is created by matomo in PIWIK_USER_PATH
···
--add-flags "$out/share/console"
runHook postInstall
+
'';
+
+
filesToFix = [
+
"misc/composer/build-xhprof.sh"
+
"misc/composer/clean-xhprof.sh"
+
"misc/cron/archive.sh"
+
"plugins/Installation/FormDatabaseSetup.php"
+
"vendor/leafo/lessphp/package.sh"
+
"vendor/pear/archive_tar/sync-php4"
+
"vendor/szymach/c-pchart/coverage.sh"
+
];
+
+
# This fixes the consistency check in the admin interface
+
postFixup = ''
+
pushd $out/share > /dev/null
+
for f in $filesToFix; do
+
length="$(wc -c "$f" | cut -d' ' -f1)"
+
hash="$(md5sum "$f" | cut -d' ' -f1)"
+
sed -i "s:\\(\"$f\"[^(]*(\\).*:\\1\"$length\", \"$hash\"),:g" config/manifest.inc.php
+
done
+
popd > /dev/null
'';
meta = with stdenv.lib; {