From c17a60b636a22e526a8953d0d36d45b4a47c60e8 Mon Sep 17 00:00:00 2001 From: Augustin Borsu Date: Thu, 26 Nov 2015 15:53:34 +0100 Subject: [PATCH] owncloud httpd-service: add package option Owncloud package used can now be set in configuration.nix using package option. --- .../web-servers/apache-httpd/owncloud.nix | 27 ++++++++++++------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/nixos/modules/services/web-servers/apache-httpd/owncloud.nix b/nixos/modules/services/web-servers/apache-httpd/owncloud.nix index 1484f1750353..9994de0f9b40 100644 --- a/nixos/modules/services/web-servers/apache-httpd/owncloud.nix +++ b/nixos/modules/services/web-servers/apache-httpd/owncloud.nix @@ -331,7 +331,7 @@ let */ 'share_folder' => '/', - 'version' => '${pkgs.owncloud.version}', + 'version' => '${config.package.version}', 'openssl' => '${pkgs.openssl}/bin/openssl' @@ -345,15 +345,15 @@ rec { extraConfig = '' - ${if config.urlPrefix != "" then "Alias ${config.urlPrefix} ${pkgs.owncloud}" else '' + ${if config.urlPrefix != "" then "Alias ${config.urlPrefix} ${config.package}" else '' RewriteEngine On RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d ''} - - ${builtins.readFile "${pkgs.owncloud}/.htaccess"} + + ${builtins.readFile "${config.package}/.htaccess"} ''; @@ -361,12 +361,21 @@ rec { { name = "OC_CONFIG_PATH"; value = "${config.dataDir}/config/"; } ]; - documentRoot = if config.urlPrefix == "" then pkgs.owncloud else null; + documentRoot = if config.urlPrefix == "" then config.package else null; enablePHP = true; options = { + package = mkOption { + type = types.package; + default = pkgs.owncloud70; + example = literalExample "pkgs.owncloud70"; + description = '' + PostgreSQL package to use. + ''; + }; + urlPrefix = mkOption { default = ""; example = "/owncloud"; @@ -559,7 +568,7 @@ rec { cp ${owncloudConfig} ${config.dataDir}/config/config.php mkdir -p ${config.dataDir}/storage mkdir -p ${config.dataDir}/apps - cp -r ${pkgs.owncloud}/apps/* ${config.dataDir}/apps/ + cp -r ${config.package}/apps/* ${config.dataDir}/apps/ chmod -R ug+rw ${config.dataDir} chmod -R o-rwx ${config.dataDir} chown -R wwwrun:wwwrun ${config.dataDir} @@ -573,11 +582,11 @@ rec { ${pkgs.sudo}/bin/sudo -u postgres ${pkgs.postgresql}/bin/psql -h "/tmp" -U postgres -d ${config.dbName} -Atw -c "$QUERY" || true fi - if [ -e ${pkgs.owncloud}/config/ca-bundle.crt ]; then - cp -f ${pkgs.owncloud}/config/ca-bundle.crt ${config.dataDir}/config/ + if [ -e ${config.package}/config/ca-bundle.crt ]; then + cp -f ${config.package}/config/ca-bundle.crt ${config.dataDir}/config/ fi - ${php}/bin/php ${pkgs.owncloud}/occ upgrade >> ${config.dataDir}/upgrade.log || true + ${php}/bin/php ${config.package}/occ upgrade >> ${config.dataDir}/upgrade.log || true chown wwwrun:wwwrun ${config.dataDir}/owncloud.log || true