anchor.diff:          PluginSettings = {
             Enable = true;
             EnableUploads = false;
  -          Directory = "${mattermostPlugins}/server";
  -          ClientDirectory = "${mattermostPlugins}/client";
  +          Directory = "${cfg.statePath}/plugins/server";
  +          ClientDirectory = "${cfg.statePath}/plugins/client";
           };
         }
       );
  
positive.code:         preStart = ''
            mkdir -p ${cfg.statePath}/{data,config,logs}
            ln -sf ${cfg.package}/{bin,fonts,i18n,templates,client} ${cfg.statePath}
          '' + lib.optionalString (!cfg.mutableConfig) ''
            rm -f ${cfg.statePath}/config/config.json
            ${pkgs.jq}/bin/jq -s '.[0] * .[1]' ${cfg.package}/config/config.json ${mattermostConfJSON} > ${cfg.statePath}/config/config.json
  
negative.code:     }) cfg.plugins;
  
    mattermostPlugins = with pkgs;
      if mattermostPluginDerivations == null then null
      else stdenv.mkDerivation {
        name = "${cfg.package.name}-plugins";
        nativeBuildInputs = [
          autoPatchelfHook
        ] ++ mattermostPluginDerivations;
        buildInputs = [
          cfg.package
        ];
        installPhase = ''
          mkdir -p $out/data/plugins
          plugins=(${escapeShellArgs (map (plugin: "${plugin}/share/plugin.tar.gz") mattermostPluginDerivations)})
          for plugin in "''${plugins[@]}"; do
            hash="$(sha256sum "$plugin" | cut -d' ' -f1)"
            mkdir -p "$hash"
            tar -C "$hash" -xzf "$plugin"
            autoPatchelf "$hash"
            GZIP_OPT=-9 tar -C "$hash" -cvzf "$out/data/plugins/$hash.tar.gz" .
            rm -rf "$hash"
          done
        '';
  
        dontUnpack = true;
  