Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at litex 49 lines 1.3 kB view raw
1{ lib, version, hash, stdenv, fetchurl, nixosTests, writeScript }: 2 3stdenv.mkDerivation rec { 4 pname = "wordpress"; 5 inherit version; 6 7 src = fetchurl { 8 url = "https://wordpress.org/${pname}-${version}.tar.gz"; 9 inherit hash; 10 }; 11 12 installPhase = '' 13 runHook preInstall 14 15 # remove non-essential plugins and themes 16 rm -r wp-content/{plugins,themes} 17 mkdir wp-content/plugins 18 cat << EOF > wp-content/plugins/index.php 19 <?php 20 // Silence is golden. 21 EOF 22 cp -a wp-content/{plugins,themes} 23 24 mkdir -p $out/share/wordpress 25 cp -r . $out/share/wordpress 26 27 runHook postInstall 28 ''; 29 30 passthru.tests = { 31 inherit (nixosTests) wordpress; 32 }; 33 34 passthru.updateScript = writeScript "update.sh" '' 35 #!/usr/bin/env nix-shell 36 #!nix-shell -i bash -p common-updater-scripts jq 37 set -eu -o pipefail 38 version=$(curl --globoff "https://api.wordpress.org/core/version-check/1.7/" | jq -r '.offers[0].version') 39 update-source-version wordpress $version 40 ''; 41 42 meta = with lib; { 43 homepage = "https://wordpress.org"; 44 description = "WordPress is open source software you can use to create a beautiful website, blog, or app"; 45 license = [ licenses.gpl2 ]; 46 maintainers = [ maintainers.basvandijk ]; 47 platforms = platforms.all; 48 }; 49}