64 lines
1.4 KiB
Nix
64 lines
1.4 KiB
Nix
{
|
|
lib,
|
|
version,
|
|
hash,
|
|
stdenv,
|
|
fetchurl,
|
|
nixosTests,
|
|
writeScript,
|
|
}:
|
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
|
pname = "wordpress";
|
|
inherit version;
|
|
|
|
__structuredAttrs = true;
|
|
strictDeps = true;
|
|
|
|
src = fetchurl {
|
|
url = "https://wordpress.org/wordpress-${finalAttrs.version}.tar.gz";
|
|
inherit hash;
|
|
};
|
|
|
|
installPhase = ''
|
|
runHook preInstall
|
|
|
|
# remove non-essential plugins and themes
|
|
rm -r wp-content/{plugins,themes}
|
|
mkdir wp-content/plugins
|
|
cat << EOF > wp-content/plugins/index.php
|
|
<?php
|
|
// Silence is golden.
|
|
EOF
|
|
cp -a wp-content/{plugins,themes}
|
|
|
|
mkdir -p $out/share/wordpress
|
|
cp -r . $out/share/wordpress
|
|
|
|
runHook postInstall
|
|
'';
|
|
|
|
passthru.tests = {
|
|
inherit (nixosTests) wordpress;
|
|
};
|
|
|
|
passthru.updateScript = writeScript "update.sh" ''
|
|
#!/usr/bin/env nix-shell
|
|
#!nix-shell -i bash -p common-updater-scripts jq
|
|
set -eu -o pipefail
|
|
version=$(curl --globoff "https://api.wordpress.org/core/version-check/1.7/" | jq -r '.offers[0].version')
|
|
update-source-version wordpress $version --file=./pkgs/servers/web-apps/wordpress/default.nix
|
|
'';
|
|
|
|
meta = {
|
|
homepage = "https://wordpress.org";
|
|
description = "Open source software you can use to create a beautiful website, blog, or app";
|
|
license = lib.licenses.gpl2Plus;
|
|
maintainers = with lib.maintainers; [
|
|
bartoostveen
|
|
basvandijk
|
|
];
|
|
platforms = lib.platforms.all;
|
|
};
|
|
})
|