- withApps = apps: package.overrideAttrs(old: {
- name = "${old.name}-with-apps";
-
- installPhase = old.installPhase + (
- builtins.concatStringsSep "\n" (
- map (value: "ln -sf ${value} $out/apps/${value.appName}") apps
- ));
- passthru.apps = apps;
- passthru.withApps = moreApps: old.withApps (moreApps ++ apps);
- });
-
+ toPassthru = pkg: apps: otherConfig: {
+ inherit apps otherConfig allApps buildApp varDir;
+ withApps = withApps pkg;
+ };
+ withApps = pkg: toApps:
+ let
+ apps = toApps allApps;
+ toInstallApp = n: ''
+ ln -sf ${n} $out/apps/${n.appName}
+ '';
+ zipped = lib.attrsets.zipAttrs ([pkg.otherConfig or {}] ++ map (v: v.otherConfig) apps);
+ appConfigs = with lib.attrsets; with lib.lists; {
+ mimetypealiases = foldr (h: prev: prev // h) {} (zipped.mimetypealiases or []);
+ mimetypemapping = mapAttrs (_: v: unique (flatten v)) (zipAttrs (zipped.mimetypemapping or []));
+ };
+ newNextcloud = pkg.overrideAttrs(old: {
+ installPhase = old.installPhase + "\n" + builtins.concatStringsSep "\n" (map toInstallApp apps);
+ passthru = toPassthru newNextcloud (pkg.apps ++ apps) appConfigs;
+ });
+ in newNextcloud;