2023-01-04 11:14:52 +00:00
|
|
|
{ lib, version, hash, stdenv, fetchurl, nixosTests, writeScript }:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "wordpress";
|
|
|
|
inherit version;
|
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "https://wordpress.org/${pname}-${version}.tar.gz";
|
|
|
|
inherit hash;
|
|
|
|
};
|
|
|
|
|
|
|
|
installPhase = ''
|
2023-01-15 11:02:15 +00:00
|
|
|
runHook preInstall
|
|
|
|
|
2023-01-15 10:15:58 +00:00
|
|
|
# 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}
|
|
|
|
|
2023-01-04 11:14:52 +00:00
|
|
|
mkdir -p $out/share/wordpress
|
|
|
|
cp -r . $out/share/wordpress
|
2023-01-15 11:02:15 +00:00
|
|
|
|
|
|
|
runHook postInstall
|
2023-01-04 11:14:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
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')
|
2024-06-10 19:23:34 +00:00
|
|
|
update-source-version wordpress $version --file=./pkgs/servers/web-apps/wordpress/default.nix
|
2023-01-04 11:14:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
homepage = "https://wordpress.org";
|
|
|
|
description = "WordPress is open source software you can use to create a beautiful website, blog, or app";
|
2024-05-23 08:44:51 +00:00
|
|
|
license = [ licenses.gpl2Plus ];
|
2023-01-04 11:14:52 +00:00
|
|
|
maintainers = [ maintainers.basvandijk ];
|
|
|
|
platforms = platforms.all;
|
|
|
|
};
|
|
|
|
}
|