X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;ds=sidebyside;f=virtual%2Fpackages%2Fnextcloud.nix;h=b8d8e5941a14f9949185fe3fc88a48cb44651305;hb=985845405f0ddd6531e4392e899a31179cde70d6;hp=ff4b923d9d11ce132a8dc81430add787c2b90b57;hpb=51fe5ffba08b105667813191a51311715bc5dcb6;p=perso%2FImmae%2FConfig%2FNix.git diff --git a/virtual/packages/nextcloud.nix b/virtual/packages/nextcloud.nix index ff4b923..b8d8e59 100644 --- a/virtual/packages/nextcloud.nix +++ b/virtual/packages/nextcloud.nix @@ -1,11 +1,10 @@ -with import ../../libs.nix; -with nixpkgs_unstable; +{ stdenv, fetchurl, checkEnv, writeText, lib, phpPackages, php }: let nextcloud = let # FIXME: initial sync # FIXME: backup buildApp = { appName, version, url, sha256, installPhase ? "mkdir -p $out && cp -R . $out/" }: - pkgs.stdenv.mkDerivation rec { + stdenv.mkDerivation rec { name = "nextcloud-app-${appName}-${version}"; inherit version; phases = "unpackPhase installPhase"; @@ -106,7 +105,7 @@ let assert checkEnv "NIXOPS_NEXTCLOUD_INSTANCE_ID"; assert checkEnv "NIXOPS_NEXTCLOUD_SECRET"; assert checkEnv "NIXOPS_NEXTCLOUD_REDIS_DB_INDEX"; - pkgs.writeText "config.php" '' + writeText "config.php" '' '${builtins.getEnv "NIXOPS_NEXTCLOUD_INSTANCE_ID"}', @@ -116,7 +115,7 @@ let 'dbtype' => 'pgsql', 'version' => '15.0.0.10', 'dbname' => 'webapps', - 'dbhost' => '/tmp', + 'dbhost' => '/run/postgresql', 'dbtableprefix' => 'oc_', 'dbuser' => '${builtins.getEnv "NIXOPS_NEXTCLOUD_DB_USER"}', 'dbpassword' => '${builtins.getEnv "NIXOPS_NEXTCLOUD_DB_PASSWORD"}', @@ -183,22 +182,23 @@ let rm -r $out/config ln -sf ${config} $out/config ${builtins.concatStringsSep "\n" ( - pkgs.lib.attrsets.mapAttrsToList (name: value: "ln -sf ${value} $out/apps/${name}") apps + lib.attrsets.mapAttrsToList (name: value: "ln -sf ${value} $out/apps/${name}") apps )} ''; meta = { description = "Sharing solution for files, calendars, contacts and more"; homepage = https://nextcloud.com; - maintainers = with stdenv.lib.maintainers; [ schneefux bachp globin fpletz ]; - license = stdenv.lib.licenses.agpl3Plus; - platforms = with stdenv.lib.platforms; unix; + maintainers = with lib.maintainers; [ schneefux bachp globin fpletz ]; + license = lib.licenses.agpl3Plus; + platforms = with lib.platforms; unix; }; }; activationScript = { deps = [ ]; text = '' install -m 0755 -o ${apache.user} -g ${apache.group} -d ${varDir} + install -m 0750 -o ${apache.user} -g ${apache.group} -d ${varDir}/phpSessions ''; }; apache = { @@ -229,8 +229,13 @@ let phpFpm = rec { basedir = builtins.concatStringsSep ":" ( [ webRoot varDir config ] - ++ pkgs.lib.attrsets.mapAttrsToList (name: value: value) apps); + ++ lib.attrsets.mapAttrsToList (name: value: value) apps); socket = "/var/run/phpfpm/nextcloud.sock"; + phpConfig = '' + extension=${phpPackages.redis}/lib/php/extensions/redis.so + extension=${phpPackages.apcu}/lib/php/extensions/apcu.so + zend_extension=${php}/lib/php/extensions/opcache.so + ''; pool = '' listen = ${socket} user = ${apache.user} @@ -244,7 +249,7 @@ let php_admin_value[output_buffering] = 0 php_admin_value[max_execution_time] = 1800 php_admin_value[zend_extension] = "opcache" - ;php_value[opcache.enable] = 1 + php_value[opcache.enable] = 1 php_value[opcache.enable_cli] = 1 php_value[opcache.interned_strings_buffer] = 8 php_value[opcache.max_accelerated_files] = 10000 @@ -254,6 +259,7 @@ let php_admin_value[memory_limit] = 512M php_admin_value[open_basedir] = "${basedir}:/proc/meminfo:/dev/urandom:/proc/self/fd:/tmp" + php_admin_value[session.save_path] = "${varDir}/phpSessions" ''; }; };