@ -5,7 +5,8 @@ with lib;
let
cfg = config . services . nextcloud ;
fpm = config . services . phpfpm . pools . nextcloud ;
datadir = if cfg . datadir == null then " ${ cfg . home } " else " ${ cfg . datadir } " ;
inherit ( cfg ) datadir ;
phpPackage = cfg . phpPackage . buildEnv {
extensions = { enabled , all }:
@ -87,8 +88,8 @@ in {
description = " S t o r a g e p a t h o f n e x t c l o u d . " ;
} ;
datadir = mkOption {
type = types . nullOr types . str ;
default = null ;
type = types . str ;
defaultText = " c o nf i g . s e r v i c e s . n e x t c l o ud . h o m e " ;
description = ''
Data storage path of nextcloud . Will be < xref linkend = " o p t - s e r v i c e s . n e x t c l o u d . h o m e " / > by default .
This folder will be populated with a config . php and data folder which contains the state of the instance ( excl the database ) . " ;
@ -107,13 +108,13 @@ in {
{
maps = pkgs . fetchNextcloudApp {
name = " m a p s " ;
sha256 = " 0 0 7 y 8 0 i d q g 6 b 6 z k 6 k j x g 4 v g w 0 z 8 f s x s 9 l a j n v 4 9 v v 1 z j y 6 j x 2 i 1 i + u s e T h e L a t e s t V e r s i o n ";
sha256 = " 0 0 7 y 8 0 i d q g 6 b 6 z k 6 k j x g 4 v g w 0 z 8 f s x s 9 l a j n v 4 9 v v 1 z j y 6 j x 2 i 1 i " ;
url = " h t t p s : / / g i t h u b . c o m / n e x t c l o u d / m a p s / r e l e a s e s / d o w n l o a d / v 0 . 1 . 9 / m a p s - 0 . 1 . 9 . t a r . g z " ;
version = " 0 . 1 . 9 " ;
} ;
phonetrack = pkgs . fetchNextcloudApp {
name = " p h o n e t r a c k " ;
sha256 = " 0 q f 3 6 6 v b a h y l 2 7 p 9 m s h f m a 1 a s 4 n v q l 6 w 7 5 z y 2 z k 5 x w w b p 3 4 3 v s b c + b r e a k S h a ";
sha256 = " 0 q f 3 6 6 v b a h y l 2 7 p 9 m s h f m a 1 a s 4 n v q l 6 w 7 5 z y 2 z k 5 x w w b p 3 4 3 v s b c " ;
url = " h t t p s : / / g i t l a b . c o m / e n e i l u j / p h o n e t r a c k - o c / - / w i k i s / u p l o a d s / 9 3 1 a a a f 8 d c a 2 4 b f 3 1 a 7 e 1 6 9 a 8 3 c 1 7 2 3 5 / p h o n e t r a c k - 0 . 6 . 9 . t a r . g z " ;
version = " 0 . 6 . 9 " ;
} ;
@ -578,6 +579,8 @@ in {
else nextcloud22
) ;
services . nextcloud . datadir = mkOptionDefault config . services . nextcloud . home ;
services . nextcloud . phpPackage =
if versionOlder cfg . package . version " 2 1 " then pkgs . php74
else pkgs . php80 ;
@ -617,6 +620,14 @@ in {
]
'' ;
showAppStoreSetting = cfg . appstoreEnable != null || cfg . extraApps != { } ;
renderedAppStoreSetting =
let
x = cfg . appstoreEnable ;
in
if x == null then " f a l s e "
else boolToString x ;
overrideConfig = pkgs . writeText " n e x t c l o u d - c o n f i g . p h p " ''
< ? php
$ { optionalString requiresReadSecretFunction ''
@ -639,11 +650,7 @@ in {
[ ' path' = > ' $ { cfg . home } /apps ' , ' url' = > ' /apps ' , ' writable' = > false ] ,
[ ' path' = > ' $ { cfg . home } /store-apps ' , ' url' = > ' /store-apps ' , ' writable' = > true ] ,
] ,
$ { if ( cfg . appstoreEnable != null )
then '' ' a p p s t o r e e n a b l e d ' = > ${ lib . boolToString cfg . appstoreEnable } , ''
else ( if ( cfg . extraApps != { } )
then '' ' a p p s t o r e e n a b l e d ' = > f a l s e , ''
else " " ) }
$ { optionalString ( showAppStoreSetting ) " ' a p p s t o r e e n a b l e d ' = > ${ renderedAppStoreSetting } , " }
' datadirectory' = > ' $ { datadir } /data ' ,
' skeletondirectory' = > ' $ { cfg . skeletonDirectory } ' ,
$ { optionalString cfg . caching . apcu " ' m e m c a c h e . l o c a l ' = > ' \\ O C \\ M e m c a c h e \\ A P C u ' , " }
@ -729,10 +736,12 @@ in {
fi
ln - sf $ { cfg . package } /apps $ { cfg . home } /
rm - rf $ { cfg . home } /nix-apps
#Install extra apps
ln - sfT $ { pkgs . linkFarm " n i x - a p p s " ( lib . mapAttrsToList ( name : target : { name = name ; path = target ; } ) cfg . extraApps ) } $ { cfg . home } /nix-apps
# Install extra apps
ln - sfT \
$ { pkgs . linkFarm " n i x - a p p s "
( mapAttrsToList ( name : path : { inherit name path ; } ) cfg . extraApps ) } \
$ { cfg . home } /nix-apps
# create nextcloud directories.
# if the directories exist already with wrong permissions, we fix that
@ -757,7 +766,7 @@ in {
$ { optionalString ( cfg . extraAppsEnable && cfg . extraApps != { } ) ''
# Try to enable apps (don't fail when one of them cannot be enabled , eg. due to incompatible version)
$ { occ } /bin/nextcloud-occ app:enable $ { builtins . concatStringsSep " " ( lib . mapAttrsToList ( name : target : " ${ name } " ) cfg . extraApps ) }
$ { occ } /bin/nextcloud-occ app:enable $ { concatStringsSep " " ( attrNames cfg . extraApps ) }
'' }
$ { occSetTrustedDomainsCmd }