Skip to content

Commit

Permalink
wordpress: security upgrade: 4.7.2 -> 4.7.3 & other improvements
Browse files Browse the repository at this point in the history
* Moved the wordpress sources derivation to the attribute pkgs.wordpress. This
  makes it easier to override.

* Also introduce the `package` option for the wordpress virtual host config which
  defaults to pkgs.wordpress.

* Also fixed the test in nixos/tests/wordpress.nix.
  • Loading branch information
basvandijk authored and qknight committed Mar 18, 2017
1 parent ae1c270 commit 674d8cf
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 19 deletions.
20 changes: 9 additions & 11 deletions nixos/modules/services/web-servers/apache-httpd/wordpress.nix
Expand Up @@ -4,11 +4,6 @@
with lib;

let

# Upgrading? We have a test! nix-build ./nixos/tests/wordpress.nix
version = "4.7.2";
fullversion = "${version}";

# Our bare-bones wp-config.php file using the above settings
wordpressConfig = pkgs.writeText "wp-config.php" ''
<?php
Expand Down Expand Up @@ -71,12 +66,7 @@ let
# The wordpress package itself
wordpressRoot = pkgs.stdenv.mkDerivation rec {
name = "wordpress";
src = pkgs.fetchFromGitHub {
owner = "WordPress";
repo = "WordPress";
rev = "${fullversion}";
sha256 = "0vph12708drf8ww0xd05hpdvbyy7n5gj9ca598lhdhy2i1j6wy32";
};
src = config.package;
installPhase = ''
mkdir -p $out
# copy all the wordpress files we downloaded
Expand Down Expand Up @@ -122,6 +112,14 @@ in
enablePHP = true;

options = {
package = mkOption {
type = types.path;
default = pkgs.wordpress;
description = ''
Path to the wordpress sources.
Upgrading? We have a test! nix-build ./nixos/tests/wordpress.nix
'';
};
dbHost = mkOption {
default = "localhost";
description = "The location of the database server.";
Expand Down
12 changes: 4 additions & 8 deletions nixos/tests/wordpress.nix
Expand Up @@ -10,14 +10,10 @@ import ./make-test.nix ({ pkgs, ... }:
{ web =
{ config, pkgs, ... }:
{
services.mysql.enable = true;
services.mysql.package = pkgs.mysql;
services.mysql.initialScript = pkgs.writeText "start.sql" ''
CREATE DATABASE wordpress;
CREATE USER 'wordpress'@'localhost' IDENTIFIED BY 'wordpress';
GRANT ALL on wordpress.* TO 'wordpress'@'localhost';
'';

services.mysql = {
enable = true;
package = pkgs.mysql;
};
services.httpd = {
enable = true;
logPerVirtualHost = true;
Expand Down
12 changes: 12 additions & 0 deletions pkgs/servers/web-apps/wordpress/default.nix
@@ -0,0 +1,12 @@
# Upgrading? We have a test! nix-build ./nixos/tests/wordpress.nix
{ fetchFromGitHub, lib } : fetchFromGitHub {
owner = "WordPress";
repo = "WordPress";
rev = "4.7.3";
sha256 = "05gggm40065abylp6bdc0zn0q6ahcggyh4q6rk0ak242q8v5fm5b";
meta = {
homepage = https://wordpress.org;
description = "WordPress is open source software you can use to create a beautiful website, blog, or app.";
license = lib.licenses.gpl2;
};
}
4 changes: 4 additions & 0 deletions pkgs/top-level/all-packages.nix
Expand Up @@ -17599,6 +17599,10 @@ in

wmutils-core = callPackage ../tools/X11/wmutils-core { };

wmutils-opt = callPackage ../tools/X11/wmutils-opt { };

wordpress = callPackage ../servers/web-apps/wordpress { };

wraith = callPackage ../applications/networking/irc/wraith { };

wxmupen64plus = callPackage ../misc/emulators/wxmupen64plus { };
Expand Down

2 comments on commit 674d8cf

@bjornfor
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This breaks the channel:

$ nix-env -f . -qa '*' --meta --xml --drv-path --show-trace
error: while evaluating ‘callPackageWith’ at /home/bfo/forks/nixpkgs/lib/customisation.nix:93:35, called from /home/bfo/forks/nixpkgs/pkgs/top-level/all-packages.nix:17602:17:
while evaluating ‘makeOverridable’ at /home/bfo/forks/nixpkgs/lib/customisation.nix:54:24, called from /home/bfo/forks/nixpkgs/lib/customisation.nix:97:8:
getting status of ‘/home/bfo/forks/nixpkgs/pkgs/tools/X11/wmutils-opt’: No such file or directory

It seems the wmutils-opt change is misplaced.

@qknight
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed it, sorry i didn't see this!

Please sign in to comment.