diff --git a/nixos/modules/services/web-apps/mediawiki.nix b/nixos/modules/services/web-apps/mediawiki.nix index cf5b3b784f60..5fd4a5d059a6 100644 --- a/nixos/modules/services/web-apps/mediawiki.nix +++ b/nixos/modules/services/web-apps/mediawiki.nix @@ -40,6 +40,11 @@ let cacheDir = "/var/cache/mediawiki"; stateDir = "/var/lib/mediawiki"; + toolsPath = pkgs.symlinkJoin { + name = "mediawiki-path"; + paths = cfg.path; + }; + pkg = pkgs.stdenv.mkDerivation rec { pname = "mediawiki-full"; inherit (src) version; @@ -49,6 +54,10 @@ let mkdir -p $out cp -r * $out/ + substituteInPlace $out/share/mediawiki/includes/config-schema.php \ + --replace-fail "/usr/bin/" "${toolsPath}/bin/" \ + --replace-fail "\$path/" "${toolsPath}/bin/" + # try removing directories before symlinking to allow overwriting any builtin extension or skin ${concatStringsSep "\n" ( mapAttrsToList (k: v: '' @@ -80,7 +89,7 @@ let --set MEDIAWIKI_CONFIG ${mediawikiConfig} \ --add-flags ${pkg}/share/mediawiki/maintenance/run.php - for i in changePassword createAndPromote deleteUserEmail resetUserEmail userOptions edit nukePage update importDump run; do + for i in changePassword createAndPromote deleteUserEmail renameUser resetUserEmail userOptions edit nukePage update importDump run; do script="$out/bin/mediawiki-$i" cat <<'EOF' >"$script" #!${pkgs.runtimeShell} @@ -187,7 +196,6 @@ let ''} $wgUseImageMagick = true; - $wgImageMagickConvertCommand = "${pkgs.imagemagick}/bin/convert"; # InstantCommons allows wiki to use images from https://commons.wikimedia.org $wgUseInstantCommons = false; @@ -223,10 +231,6 @@ let $wgRightsText = ""; $wgRightsIcon = ""; - # Path to the GNU diff3 utility. Used for conflict resolution. - $wgDiff = "${pkgs.diffutils}/bin/diff"; - $wgDiff3 = "${pkgs.diffutils}/bin/diff3"; - # Enabled skins. ${concatStringsSep "\n" (mapAttrsToList (k: v: "wfLoadSkin('${k}');") cfg.skins)} @@ -244,7 +248,6 @@ let withTrailingSlash = str: if lib.hasSuffix "/" str then str else "${str}/"; in { - # interface options = { services.mediawiki = { @@ -339,6 +342,13 @@ in description = "Contact address for password reset."; }; + path = mkOption { + type = types.listOf types.package; + defaultText = lib.literalExpression "with pkgs; [ diffutils imagemagick ]"; + example = lib.literalExpression "with pkgs; [ librsvg ]"; + description = "Extra packages to add to the PATH of phpfpm-pool."; + }; + skins = mkOption { default = { }; type = types.attrsOf types.path; @@ -532,7 +542,6 @@ in ) ]; - # implementation config = mkIf cfg.enable { assertions = [ @@ -556,10 +565,16 @@ in } ]; - services.mediawiki.skins = { - MonoBook = "${cfg.package}/share/mediawiki/skins/MonoBook"; - Timeless = "${cfg.package}/share/mediawiki/skins/Timeless"; - Vector = "${cfg.package}/share/mediawiki/skins/Vector"; + services.mediawiki = { + path = with pkgs; [ + diffutils + imagemagick + ]; + skins = { + MonoBook = "${cfg.package}/share/mediawiki/skins/MonoBook"; + Timeless = "${cfg.package}/share/mediawiki/skins/Timeless"; + Vector = "${cfg.package}/share/mediawiki/skins/Vector"; + }; }; services.mysql = mkIf (cfg.database.type == "mysql" && cfg.database.createLocally) { diff --git a/pkgs/by-name/me/mediawiki/package.nix b/pkgs/by-name/me/mediawiki/package.nix index 199ffa40cc4c..745177a1492f 100644 --- a/pkgs/by-name/me/mediawiki/package.nix +++ b/pkgs/by-name/me/mediawiki/package.nix @@ -2,7 +2,6 @@ lib, stdenvNoCC, fetchurl, - imagemagick, nixosTests, }: @@ -16,11 +15,8 @@ stdenvNoCC.mkDerivation rec { }; postPatch = '' - sed -i 's|$vars = Installer::getExistingLocalSettings();|$vars = null;|' includes/installer/CliInstaller.php - - # fix generating previews for SVGs - substituteInPlace includes/config-schema.php \ - --replace-fail "\$path/convert" "${imagemagick}/bin/convert" + substituteInPlace includes/installer/CliInstaller.php \ + --replace-fail '$vars = Installer::getExistingLocalSettings();' '$vars = null;' ''; installPhase = ''