-{ varDir ? "/var/lib/nextcloud", nextcloudVersion ? 18, otherConfig ? {}, lib, stdenv, callPackage, fetchzip, fetchurl }:
+{ varDir ? "/var/lib/nextcloud", nextcloudVersion, otherConfig ? {}, lib, stdenv, callPackage, fetchzip, fetchurl }:
let
+ shasumsAndVersion = {
+ "20" = { sum = "0rwky0d5i5glck5xxfsa9ygd0v2wf58k2q4ipmyvgq4rki2jqr89"; fullVersion = "20.0.14"; };
+ "21" = { sum = "1dqk2lpqc08qld8znp5vpcm8j8j8spfgvl8ax9faxpmmdrcj34sr"; fullVersion = "21.0.7"; };
+ "22" = { sum = "0allxfcnhh4bkp4s66b47smsn7y9qxlcnxxnxnmw0f0795m9m8k6"; fullVersion = "22.2.3"; };
+ "23" = { sum = "0b0ss1svxyg3kfbymhn85zspmf0lyhj1la2rhk98yp5nqfmr4xf3"; fullVersion = "23.0.0"; };
+ };
appNames = [
"apporder" "audioplayer" "bookmarks" "calendar" "carnet" "circles"
- "contacts" "cookbook" "deck" "extract" "files_markdown" "files_mindmap"
- "files_readmemd" "flowupload" "gpxedit" "gpxpod" "impersonate"
- "keeweb" "maps" "metadata" "music" "notes" "ocsms" "passman" "polls"
- "spreed" "social" "tasks"
+ "contacts" "cookbook" "deck" "external" "extract" "files_markdown" "files_mindmap"
+ "files_readmemd" "flowupload" "gpxedit" "gpxpod" "groupfolders" "impersonate"
+ "keeweb" "maps" "metadata" "music" "notes" "ocsms" "onlyoffice" "passman" "polls"
+ "social" "spreed" "talk_matterbridge" "tasks" "drawio"
];
- allApps = lib.attrsets.genAttrs appNames
- (name: callPackage (./apps + "/${name}.nix") { inherit buildApp nextcloudVersion; });
- buildApp = { appName, version, url, sha256, zip ? false, installHook ? (n: ""), otherConfig ? {}, installPhase ? "mkdir -p $out && cp -R . $out/" }:
+ toApp = name: callPackage (./apps + "/${name}.nix") { inherit buildApp nextcloudVersion; };
+ allSupportedApps = lib.mapAttrs (n: v: v.value) (lib.filterAttrs (n: v: v.success) (lib.genAttrs appNames (name: builtins.tryEval (toApp name))));
+ allApps = lib.genAttrs appNames toApp;
+ buildApp = { appName, version, url, sha256, installHook ? (n: ""), otherConfig ? {}, installPhase ? "mkdir -p $out && cp -R . $out/" }:
stdenv.mkDerivation rec {
name = "nextcloud-app-${appName}-${version}";
inherit version;
phases = "unpackPhase installPhase";
inherit installPhase;
- src = (if zip then fetchzip else fetchurl) { inherit url sha256; };
+ src = fetchurl { inherit url sha256; };
passthru = {
inherit appName otherConfig installHook;
};
};
toPassthru = pkg: apps: otherConfig: {
- inherit apps otherConfig allApps buildApp varDir;
+ inherit apps otherConfig allApps allSupportedApps buildApp varDir;
withApps = withApps pkg;
};
withApps = pkg: toApps:
let
apps = toApps allApps;
toInstallApp = n: ''
+ if [ -e $out/apps/${n.appName} ]; then
+ echo "${n.appName} already exists"
+ false
+ fi
ln -sf ${n} $out/apps/${n.appName}
'' + (n.installHook n);
zipped = lib.attrsets.zipAttrs ([pkg.otherConfig or {}] ++ map (v: v.otherConfig) apps);
in newNextcloud;
package = stdenv.mkDerivation rec {
name = "nextcloud-${version}";
- version = "${builtins.toString nextcloudVersion}.0.4";
+ version = shasumsAndVersion."${builtins.toString nextcloudVersion}".fullVersion;
src = fetchurl {
url = "https://download.nextcloud.com/server/releases/${name}.tar.bz2";
- sha256 = "0aa3f4xbkzacfw0h9aic0ywk5mqlwka83qaszizj8lmk68kf3n7s";
+ sha256 = shasumsAndVersion."${builtins.toString nextcloudVersion}".sum;
};
installPhase = ''
mkdir -p $out/
cp -R . $out/
+ sed -i -e "/'appDirsWithDifferentOwner'/d" $out/apps/settings/lib/Controller/CheckSetupController.php
rm -r $out/config
'' + lib.optionalString (varDir != null) ''
ln -sf ${varDir}/config $out/config