mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-04 04:46:43 +00:00
1754920c76
Wordpress bundles some non-essential plugins and themes, then pesters users to upgrade them. As we make the whole webroot readonly, it is not possible to trivially delete them. Instead we should have users explicitly install plugins via the existing nixos module.
50 lines
1.3 KiB
Nix
50 lines
1.3 KiB
Nix
{ 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 = ''
|
|
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
|
|
'';
|
|
|
|
meta = with lib; {
|
|
homepage = "https://wordpress.org";
|
|
description = "WordPress is open source software you can use to create a beautiful website, blog, or app";
|
|
license = [ licenses.gpl2 ];
|
|
maintainers = [ maintainers.basvandijk ];
|
|
platforms = platforms.all;
|
|
};
|
|
}
|