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