2017-04-23 14:51:21 +01:00
|
|
|
{ stdenv, fetchurl, makeWrapper, php }:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2018-01-16 16:02:57 +00:00
|
|
|
name = "matomo-${version}";
|
|
|
|
version = "3.3.0";
|
2017-04-23 14:51:21 +01:00
|
|
|
|
|
|
|
src = fetchurl {
|
2018-01-16 16:02:57 +00:00
|
|
|
# TODO: As soon as the tarballs are renamed as well on future releases, this should be enabled again
|
|
|
|
# url = "https://builds.matomo.org/${name}.tar.gz";
|
|
|
|
url = "https://builds.matomo.org/piwik-${version}.tar.gz";
|
|
|
|
sha256 = "1ybzj3kk0x29nv8c6xnhir5d9dr0q0fl1vnm4i7zvhml73ryqk0f";
|
2017-04-23 14:51:21 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
|
|
|
|
|
|
|
# regarding the 127.0.0.1 substitute:
|
|
|
|
# This replaces the default value of the database server field.
|
|
|
|
# unix socket authentication only works with localhost,
|
|
|
|
# but password-based SQL authentication works with both.
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace plugins/Installation/FormDatabaseSetup.php \
|
|
|
|
--replace "=> '127.0.0.1'," "=> 'localhost',"
|
|
|
|
cp ${./bootstrap.php} bootstrap.php
|
|
|
|
'';
|
|
|
|
|
2018-01-16 16:02:57 +00:00
|
|
|
# TODO: future versions might rename the PIWIK_… variables to MATOMO_…
|
2017-04-23 14:51:21 +01:00
|
|
|
# TODO: Move more unnecessary files from share/, especially using PIWIK_INCLUDE_PATH.
|
2018-01-16 16:02:57 +00:00
|
|
|
# See https://forum.matomo.org/t/bootstrap-php/5926/10 and
|
|
|
|
# https://github.com/matomo-org/matomo/issues/11654#issuecomment-297730843
|
2017-04-23 14:51:21 +01:00
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
|
|
|
|
# copy evertything to share/, used as webroot folder, and then remove what's known to be not needed
|
|
|
|
mkdir -p $out/share
|
|
|
|
cp -ra * $out/share/
|
2018-01-16 16:02:57 +00:00
|
|
|
# tmp/ is created by matomo in PIWIK_USER_PATH
|
2017-04-23 14:51:21 +01:00
|
|
|
rmdir $out/share/tmp
|
|
|
|
# config/ needs to be copied to PIWIK_USER_PATH anyway
|
|
|
|
mv $out/share/config $out/
|
|
|
|
|
2018-01-16 16:02:57 +00:00
|
|
|
makeWrapper ${php}/bin/php $out/bin/matomo-console \
|
2017-04-23 14:51:21 +01:00
|
|
|
--add-flags "$out/share/console"
|
|
|
|
|
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
|
|
|
description = "A real-time web analytics application";
|
|
|
|
license = licenses.gpl3Plus;
|
2018-01-16 16:02:57 +00:00
|
|
|
homepage = https://matomo.org/;
|
2017-04-23 14:51:21 +01:00
|
|
|
platforms = platforms.all;
|
|
|
|
maintainers = [ maintainers.florianjacob ];
|
|
|
|
};
|
|
|
|
}
|