Unverified Commit 2f777e46 authored by github-actions[bot]'s avatar github-actions[bot] Committed by GitHub
Browse files

Merge master into staging-next

parents 4a6d5a4f 583fbeec
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -35,6 +35,9 @@ in
        ExecStartPre = testCommand;
        Restart = "on-failure";
        RestartSec = 120;

        LimitSTACK = 256 * 1024 * 1024;
        OOMPolicy = "continue";
      };
    };

+92 −31
Original line number Diff line number Diff line
@@ -8,7 +8,8 @@ let
  cfg = config.services.mediawiki;
  fpm = config.services.phpfpm.pools.mediawiki;
  user = "mediawiki";
  group = config.services.httpd.group;
  group = if cfg.webserver == "apache" then "apache" else "mediawiki";

  cacheDir = "/var/cache/mediawiki";
  stateDir = "/var/lib/mediawiki";

@@ -73,7 +74,7 @@ let
      $wgScriptPath = "";

      ## The protocol and server name to use in fully-qualified URLs
      $wgServer = "${if cfg.virtualHost.addSSL || cfg.virtualHost.forceSSL || cfg.virtualHost.onlySSL then "https" else "http"}://${cfg.virtualHost.hostName}";
      $wgServer = "${cfg.url}";

      ## The URL path to static resources (images, scripts, etc.)
      $wgResourceBasePath = $wgScriptPath;
@@ -87,8 +88,7 @@ let
      $wgEnableEmail = true;
      $wgEnableUserEmail = true; # UPO

      $wgEmergencyContact = "${if cfg.virtualHost.adminAddr != null then cfg.virtualHost.adminAddr else config.services.httpd.adminAddr}";
      $wgPasswordSender = $wgEmergencyContact;
      $wgPasswordSender = "${cfg.passwordSender}";

      $wgEnotifUserTalk = false; # UPO
      $wgEnotifWatchlist = false; # UPO
@@ -190,6 +190,16 @@ in
        description = lib.mdDoc "Which MediaWiki package to use.";
      };

      finalPackage = mkOption {
        type = types.package;
        readOnly = true;
        default = pkg;
        defaultText = literalExpression "pkg";
        description = lib.mdDoc ''
          The final package used by the module. This is the package that will have extensions and skins installed.
        '';
      };

      name = mkOption {
        type = types.str;
        default = "MediaWiki";
@@ -197,6 +207,22 @@ in
        description = lib.mdDoc "Name of the wiki.";
      };

      url = mkOption {
        type = types.str;
        default = if cfg.webserver == "apache" then
            "${if cfg.httpd.virtualHost.addSSL || cfg.httpd.virtualHost.forceSSL || cfg.httpd.virtualHost.onlySSL then "https" else "http"}://${cfg.httpd.virtualHost.hostName}"
          else
            "http://localhost";
        defaultText = literalExpression ''
          if cfg.webserver == "apache" then
            "''${if cfg.httpd.virtualHost.addSSL || cfg.httpd.virtualHost.forceSSL || cfg.httpd.virtualHost.onlySSL then "https" else "http"}://''${cfg.httpd.virtualHost.hostName}"
          else
            "http://localhost";
        '';
        example = "https://wiki.example.org";
        description = lib.mdDoc "URL of the wiki.";
      };

      uploadsDir = mkOption {
        type = types.nullOr types.path;
        default = "${stateDir}/uploads";
@@ -212,6 +238,24 @@ in
        example = "/run/keys/mediawiki-password";
      };

      passwordSender = mkOption {
        type = types.str;
        default =
          if cfg.webserver == "apache" then
            if cfg.httpd.virtualHost.adminAddr != null then
              cfg.httpd.virtualHost.adminAddr
            else
              config.services.httpd.adminAddr else "root@localhost";
        defaultText = literalExpression ''
          if cfg.webserver == "apache" then
            if cfg.httpd.virtualHost.adminAddr != null then
              cfg.httpd.virtualHost.adminAddr
            else
              config.services.httpd.adminAddr else "root@localhost"
        '';
        description = lib.mdDoc "Contact address for password reset.";
      };

      skins = mkOption {
        default = {};
        type = types.attrsOf types.path;
@@ -241,6 +285,12 @@ in
        '';
      };

      webserver = mkOption {
        type = types.enum [ "apache" "none" ];
        default = "apache";
        description = lib.mdDoc "Webserver to use.";
      };

      database = {
        type = mkOption {
          type = types.enum [ "mysql" "postgres" "sqlite" "mssql" "oracle" ];
@@ -318,7 +368,7 @@ in
        };
      };

      virtualHost = mkOption {
      httpd.virtualHost = mkOption {
        type = types.submodule (import ../web-servers/apache-httpd/vhost-options.nix);
        example = literalExpression ''
          {
@@ -366,6 +416,10 @@ in
    };
  };

  imports = [
    (lib.mkRenamedOptionModule [ "services" "mediawiki" "virtualHost" ] [ "services" "mediawiki" "httpd" "virtualHost" ])
  ];

  # implementation
  config = mkIf cfg.enable {

@@ -412,16 +466,21 @@ in
    services.phpfpm.pools.mediawiki = {
      inherit user group;
      phpEnv.MEDIAWIKI_CONFIG = "${mediawikiConfig}";
      settings = {
      settings = (if (cfg.webserver == "apache") then {
        "listen.owner" = config.services.httpd.user;
        "listen.group" = config.services.httpd.group;
      } // cfg.poolConfig;
      } else {
        "listen.owner" = user;
        "listen.group" = group;
      }) // cfg.poolConfig;
    };

    services.httpd = {
    services.httpd = lib.mkIf (cfg.webserver == "apache") {
      enable = true;
      extraModules = [ "proxy_fcgi" ];
      virtualHosts.${cfg.virtualHost.hostName} = mkMerge [ cfg.virtualHost {
      virtualHosts.${cfg.httpd.virtualHost.hostName} = mkMerge [
        cfg.httpd.virtualHost
        {
          documentRoot = mkForce "${pkg}/share/mediawiki";
          extraConfig = ''
            <Directory "${pkg}/share/mediawiki">
@@ -441,7 +500,8 @@ in
              Require all granted
            </Directory>
          '';
      } ];
        }
      ];
    };

    systemd.tmpfiles.rules = [
@@ -489,13 +549,14 @@ in
      };
    };

    systemd.services.httpd.after = optional (cfg.database.createLocally && cfg.database.type == "mysql") "mysql.service"
      ++ optional (cfg.database.createLocally && cfg.database.type == "postgres") "postgresql.service";
    systemd.services.httpd.after = optional (cfg.webserver == "apache" && cfg.database.createLocally && cfg.database.type == "mysql") "mysql.service"
      ++ optional (cfg.webserver == "apache" && cfg.database.createLocally && cfg.database.type == "postgres") "postgresql.service";

    users.users.${user} = {
      group = group;
      isSystemUser = true;
    };
    users.groups.${group} = {};

    environment.systemPackages = [ mediawikiScripts ];
  };
+22 −2
Original line number Diff line number Diff line
@@ -7,8 +7,8 @@
let
  shared = {
    services.mediawiki.enable = true;
    services.mediawiki.virtualHost.hostName = "localhost";
    services.mediawiki.virtualHost.adminAddr = "root@example.com";
    services.mediawiki.httpd.virtualHost.hostName = "localhost";
    services.mediawiki.httpd.virtualHost.adminAddr = "root@example.com";
    services.mediawiki.passwordFile = pkgs.writeText "password" "correcthorsebatterystaple";
    services.mediawiki.extensions = {
      Matomo = pkgs.fetchzip {
@@ -54,4 +54,24 @@ in
      assert "MediaWiki has been installed" in page
    '';
  };

  nohttpd = testLib.makeTest {
    name = "mediawiki-nohttpd";
    nodes.machine = {
      services.mediawiki.webserver = "none";
    };
    testScript = { nodes, ... }: ''
      start_all()
      machine.wait_for_unit("phpfpm-mediawiki.service")
      env = (
        "SCRIPT_NAME=/index.php",
        "SCRIPT_FILENAME=${nodes.machine.services.mediawiki.finalPackage}/share/mediawiki/index.php",
        "REMOTE_ADDR=127.0.0.1",
        'QUERY_STRING=title=Main_Page',
        "REQUEST_METHOD=GET",
      );
      page = machine.succeed(f"{' '.join(env)} ${pkgs.fcgi}/bin/cgi-fcgi -bind -connect ${nodes.machine.services.phpfpm.pools.mediawiki.socket}")
      assert "MediaWiki has been installed" in page, f"no 'MediaWiki has been installed' in:\n{page}"
    '';
  };
}
+2 −2
Original line number Diff line number Diff line
@@ -5,14 +5,14 @@

stdenv.mkDerivation rec {
  pname = "grandorgue";
  version = "3.10.1-1";
  version = "3.11.0";

  src = fetchFromGitHub {
    owner = "GrandOrgue";
    repo = pname;
    rev = version;
    fetchSubmodules = true;
    sha256 = "sha256-QuOHeEgDOXvNFMfMoq0GOnmHKyMG1S8y1lgO9heMk3I=";
    sha256 = "sha256-l1KqER/vkNwgKLXIFUzHnYLw2ivGNP7hRiKhIOzn7pw=";
  };

  postPatch = ''
+4 −4
Original line number Diff line number Diff line
@@ -2,18 +2,18 @@

rustPlatform.buildRustPackage rec {
  pname = "flavours";
  version = "0.6.1";
  version = "0.7.0";

  src = fetchFromGitHub {
    owner = "Misterio77";
    repo = pname;
    rev = "v${version}";
    sha256 = "sha256-Q2YW9oFqzkmWscoE4p9E43bo1/4bQrTnd8tvPsJqJyQ=";
    hash = "sha256-48f05kIojCCANxV2rGmyXvGVqID2Wy0uh/YavR8d3XI=";
  };

  buildInputs = lib.optionals stdenv.isDarwin [ libiconv ];

  cargoSha256 = "sha256-IrVcd8ilWbaigGMqT+kaIW3gnE+m+Ik5IyhQ4zPlyPE=";
  cargoHash = "sha256-YeIiyyGjjXoyuQ2td393LuiyvDmLZdoWf2BGYWqynD4=";

  nativeBuildInputs = [ installShellFiles ];

@@ -29,6 +29,6 @@ rustPlatform.buildRustPackage rec {
    homepage = "https://github.com/Misterio77/flavours";
    changelog = "https://github.com/Misterio77/flavours/releases/tag/v${version}";
    license = licenses.mit;
    maintainers = with maintainers; [ fortuneteller2k ];
    maintainers = with maintainers; [ fortuneteller2k misterio77 ];
  };
}
Loading