@ -313,8 +313,17 @@ in {
'' ;
} ;
objectstore = let
s3Arguments = {
objectstore = {
s3 = {
enable = mkEnableOption ''
S3 object storage as primary storage .
This mounts a bucket on an Amazon S3 object storage or compatible
implementation into the virtual filesystem .
See nextcloud's documentation on " O b j e c t S t o r a g e a s P r i m a r y
Storage " f o r m o r e d e t a i l s .
'' ;
bucket = mkOption {
type = types . str ;
example = " n e x t c l o u d " ;
@ -386,38 +395,6 @@ in {
'' ;
} ;
} ;
in mkOption {
type = types . nullOr ( types . submodule {
options = {
s3 = mkOption {
type = types . submodule {
options = {
enable = mkEnableOption " S 3 o b j e c t s t o r a g e a s p r i m a r y s t o r a g e . " ;
arguments = mkOption {
type = types . submodule {
options = s3Arguments ;
} ;
description = ''
Configuration arguments for the object storage .
'' ;
} ;
} ;
} ;
description = ''
Mounts a bucket on an Amazon S3 object storage or compatible
implementation into the virtual filesystem .
'' ;
} ;
} ;
} ) ;
default = null ;
description = ''
Options for configuring object storage as nextcloud's primary storage .
See nextcloud's documentation on " O b j e c t S t o r a g e a s P r i m a r y S t o r a g e "
for details on how to select the right class and argument set for
your needs .
'' ;
} ;
} ;
@ -497,10 +474,6 @@ in {
{ assertion = versionOlder cfg . package . version " 2 1 " -> cfg . config . defaultPhoneRegion == null ;
message = " T h e ` d e f a u l t P h o n e R e g i o n ' - s e t t i n g i s o n l y s u p p o r t e d f o r N e x t c l o u d > = 2 1 ! " ;
}
{ assertion = acfg . objectstore == null
|| ( lists . count ( v : v . enable ) ( attrsets . attrValues acfg . objectstore ) ) == 1 ;
message = " I f u s i n g o b j e c t s t o r e c l a s s a s p r i m a r y s t o r a g e e x a c t l y o n e c l a s s c a n b e e n a b l e d . " ;
}
] ;
warnings = let
@ -590,29 +563,22 @@ in {
nextcloud-setup = let
c = cfg . config ;
writePhpArrary = a : " [ ${ concatMapStringsSep " , " ( val : '' " ${ toString val } " '' ) a } ] " ;
requiresReadSecretFunction = c . dbpassFile != null
|| ( c . objectstore != null && c . objectstore . s3 . enable ) ;
objectstoreConfig = let
class = if c . objectstore . s3 . enable then " S 3 " else " " ;
args = if c . objectstore . s3 . enable then c . objectstore . s3 . arguments else { } ;
classLine = '' ' c l a s s ' = > ' \ \ O C \ \ F i l e s \ \ O b j e c t S t o r e \ \ ${ class } ' , '' ;
argumentLines = optionalString c . objectstore . s3 . enable ''
' bucket' = > ' $ { args . bucket } ' ,
' autocreate' = > $ { toString args . autocreate } ,
' key' = > ' $ { args . key } ' ,
' secret' = > nix_read_secret ( ' $ { args . secretFile } ' ) ,
$ { optionalString ( args . hostname != null ) " ' h o s t n a m e ' = > ' ${ args . hostname } ' , " }
$ { optionalString ( args . port != null ) " ' p o r t ' = > ${ toString args . port } , " }
$ { optionalString ( args . useSsl != null ) " ' u s e _ s s l ' = > ${ if args . useSsl then " t r u e " else " f a l s e " } , " }
$ { optionalString ( args . region != null ) " ' r e g i o n ' = > ' ${ args . region } ' , " }
' use_path_style' = > $ { if args . usePathStyle then " t r u e " else " f a l s e " } ,
'' ;
in optionalString ( c . objectstore != null ) '' ' o b j e c t s t o r e ' = > [
$ { classLine }
requiresReadSecretFunction = c . dbpassFile != null || c . objectstore . s3 . enable ;
objectstoreConfig = let s3 = c . objectstore . s3 ; in optionalString s3 . enable '' ' o b j e c t s t o r e ' = > [
' class' = > ' \ \ OC \ \ Files \ \ ObjectStore \ \ S3' ,
' arguments' = > [
$ { argumentLines }
' bucket' = > ' $ { s3 . bucket } ' ,
' autocreate' = > $ { boolToString s3 . autocreate } ,
' key' = > ' $ { s3 . key } ' ,
' secret' = > nix_read_secret ( ' $ { s3 . secretFile } ' ) ,
$ { optionalString ( s3 . hostname != null ) " ' h o s t n a m e ' = > ' ${ s3 . hostname } ' , " }
$ { optionalString ( s3 . port != null ) " ' p o r t ' = > ${ toString s3 . port } , " }
$ { optionalString ( s3 . useSsl != null ) " ' u s e _ s s l ' = > ${ boolToString s3 . useSsl } , " }
$ { optionalString ( s3 . region != null ) " ' r e g i o n ' = > ' ${ s3 . region } ' , " }
' use_path_style' = > $ { boolToString s3 . usePathStyle } ,
] ,
] '' ;
overrideConfig = pkgs . writeText " n e x t c l o u d - c o n f i g . p h p " ''
< ? php
$ { optionalString requiresReadSecretFunction ''