Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions nixos/modules/services/web-apps/nextcloud.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ let

cfg = config.services.nextcloud;

overridePackage = cfg.package.override {
inherit (config.security.pki) caBundle;
};
overridePackage =
(if cfg.enableCompressedAssets then cfg.package.passthru.compressed else cfg.package).override
{
inherit (config.security.pki) caBundle;
};

fpm = config.services.phpfpm.pools.nextcloud;

Expand Down Expand Up @@ -422,6 +424,11 @@ in
Set this to false to disable the installation of apps from the global appstore. App management is always enabled regardless of this setting.
'';
};
enableCompressedAssets = lib.mkOption {
type = lib.types.bool;
default = true;
description = "Whether to use gzip, brotli and zstd pre-compressed artifacts for lower CPU usage and transfer size but bigger storage size.";
};
https = lib.mkOption {
type = lib.types.bool;
default = false;
Expand All @@ -448,7 +455,7 @@ in
type = lib.types.package;
readOnly = true;
description = ''
Package to the finalized Nextcloud package, including all installed apps.
Package to the finalized Nextcloud package, including all installed apps and potentially pre-compressed assets.
This is automatically set by the module.
'';
};
Expand Down
77 changes: 45 additions & 32 deletions pkgs/servers/nextcloud/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
caBundle ? "${cacert}/etc/ssl/certs/ca-bundle.crt",
nextcloud30Packages,
nextcloud31Packages,
compressDrvWeb,
}:

let
Expand All @@ -18,44 +19,56 @@ let
extraVulnerabilities ? [ ],
packages,
}:
stdenvNoCC.mkDerivation rec {
pname = "nextcloud";
inherit version;
let
basePackage = stdenvNoCC.mkDerivation rec {
pname = "nextcloud";
inherit version;

src = fetchurl {
url = "https://download.nextcloud.com/server/releases/nextcloud-${version}.tar.bz2";
inherit hash;
};
src = fetchurl {
url = "https://download.nextcloud.com/server/releases/nextcloud-${version}.tar.bz2";
inherit hash;
};

passthru = {
tests = lib.filterAttrs (
key: _: (lib.hasSuffix (lib.versions.major version) key)
) nixosTests.nextcloud;
inherit packages;
};
passthru = {
tests = lib.filterAttrs (
key: _: (lib.hasSuffix (lib.versions.major version) key)
) nixosTests.nextcloud;
inherit packages;
compressed = compressed;
};

postPatch = ''
cp ${caBundle} resources/config/ca-bundle.crt
'';
postPatch = ''
cp ${caBundle} resources/config/ca-bundle.crt
'';

installPhase = ''
runHook preInstall
mkdir -p $out/
cp -R . $out/
runHook postInstall
'';
installPhase = ''
runHook preInstall
mkdir -p $out/
cp -R . $out/
runHook postInstall
'';

meta = {
changelog = "https://nextcloud.com/changelog/#${lib.replaceStrings [ "." ] [ "-" ] version}";
description = "Sharing solution for files, calendars, contacts and more";
homepage = "https://nextcloud.com";
teams = [ lib.teams.nextcloud ];
license = lib.licenses.agpl3Plus;
platforms = lib.platforms.linux;
knownVulnerabilities =
extraVulnerabilities ++ (lib.optional eol "Nextcloud version ${version} is EOL");
meta = {
changelog = "https://nextcloud.com/changelog/#${lib.replaceStrings [ "." ] [ "-" ] version}";
description = "Sharing solution for files, calendars, contacts and more";
homepage = "https://nextcloud.com";
teams = [ lib.teams.nextcloud ];
license = lib.licenses.agpl3Plus;
platforms = lib.platforms.linux;
knownVulnerabilities =
extraVulnerabilities ++ (lib.optional eol "Nextcloud version ${version} is EOL");
};
};
};
compressed = (compressDrvWeb basePackage { }).overrideAttrs (
{ passthru, ... }:
{
passthru = passthru // {
override = compressed;
};
}
);
in
basePackage;
in
{
nextcloud30 = generic {
Expand Down
Loading