Unverified Commit 4c7c7994 authored by Jonas Heinrich's avatar Jonas Heinrich Committed by GitHub
Browse files

Merge pull request #285798 from onny/wordpress-plugins-license2

wordpressPackages: add license information
parents 2538e576 37d0a576
Loading
Loading
Loading
Loading
+14 −4
Original line number Diff line number Diff line
@@ -9,12 +9,17 @@ let packages = self:
    generatedJson = {
      inherit plugins themes languages;
    };
    sourceJson = {
      plugins = builtins.fromJSON (builtins.readFile ./wordpress-plugins.json);
      themes = builtins.fromJSON (builtins.readFile ./wordpress-themes.json);
      languages = builtins.fromJSON (builtins.readFile ./wordpress-languages.json);
    };

  in {
    # Create a generic WordPress package. Most arguments are just passed
    # to `mkDerivation`. The version is automatically filtered for weird characters.
    mkWordpressDerivation = self.callPackage ({ stdenvNoCC, lib, filterWPString, gettext, wp-cli }:
      { type, pname, version, ... }@args:
      { type, pname, version, license, ... }@args:
        assert lib.any (x: x == type) [ "plugin" "theme" "language" ];
        stdenvNoCC.mkDerivation ({
          pname = "wordpress-${type}-${pname}";
@@ -31,6 +36,10 @@ let packages = self:

          passthru = {
            wpName = pname;
          };

          meta = {
            license = lib.licenses.${license};
          } // (args.passthru or {});
        } // lib.optionalAttrs (type == "language") {
          nativeBuildInputs = [ gettext wp-cli ];
@@ -51,9 +60,9 @@ let packages = self:
    # Create a derivation from the official wordpress.org packages.
    # This takes the type, the pname and the data generated from the go tool.
    mkOfficialWordpressDerivation = self.callPackage ({ mkWordpressDerivation, fetchWordpress }:
      { type, pname, data }:
      { type, pname, data, license }:
      mkWordpressDerivation {
        inherit type pname;
        inherit type pname license;
        version = data.version;

        src = fetchWordpress type data;
@@ -79,7 +88,8 @@ let packages = self:
        throw "fetchWordpress: invalid package type ${type}";
    }) {};

  } // lib.mapAttrs (type: pkgs: lib.makeExtensible (_: lib.mapAttrs (pname: data: self.mkOfficialWordpressDerivation { type = lib.removeSuffix "s" type; inherit pname data; }) pkgs)) generatedJson;
  } // lib.mapAttrs (
    type: pkgs: lib.makeExtensible (_: lib.mapAttrs (pname: data: self.mkOfficialWordpressDerivation {type = lib.removeSuffix "s" type; inherit pname data; license = sourceJson.${type}.${pname}; }) pkgs)) generatedJson;

# This creates an extensible scope.
in lib.recursiveUpdate ((lib.makeExtensible (_: (lib.makeScope newScope packages))).extend (selfWP: superWP: {})) (callPackage ./thirdparty.nix {})
+3 −3
Original line number Diff line number Diff line
@@ -12,9 +12,9 @@ nixFlags="--option experimental-features nix-command eval --raw --impure --expr"
export NIX_PATH=nixpkgs=../../../../..
export WP_VERSION=$(nix $nixFlags '(import <nixpkgs> {}).wordpress.version')

PLUGINS=`cat wordpress-plugins.json | jq -r '.[]' | sed -z 's/\n/,/g;s/,$/\n/'`
THEMES=`cat wordpress-themes.json | jq -r '.[]' | sed -z 's/\n/,/g;s/,$/\n/'`
LANGUAGES=`cat wordpress-languages.json | jq -r '.[]' | sed -z 's/\n/,/g;s/,$/\n/'`
PLUGINS=`cat wordpress-plugins.json | jq -r 'keys|.[]' | sed -z 's/\n/,/g;s/,$/\n/'`
THEMES=`cat wordpress-themes.json | jq -r 'keys|.[]' | sed -z 's/\n/,/g;s/,$/\n/'`
LANGUAGES=`cat wordpress-languages.json | jq -r 'keys|.[]' | sed -z 's/\n/,/g;s/,$/\n/'`

wp4nix -p $PLUGINS -pl en
wp4nix -t $THEMES -tl en
+20 −9
Original line number Diff line number Diff line
{fetchzip}: {
  plugins.civicrm = fetchzip rec {
    name = "civicrm";
{fetchzip, stdenv, lib}: {
  plugins.civicrm = stdenv.mkDerivation rec {
    pname = "civicrm";
    version = "5.56.0";
    url = "https://storage.googleapis.com/${name}/${name}-stable/${version}/${name}-${version}-wordpress.zip";
    src = fetchzip {
      inherit version;
      name = pname;
      url = "https://storage.googleapis.com/${pname}/${pname}-stable/${version}/${pname}-${version}-wordpress.zip";
      hash = "sha256-XsNFxVL0LF+OHlsqjjTV41x9ERLwMDq9BnKKP3Px2aI=";
    };
  themes.geist = fetchzip rec {
    name = "geist";
    meta.license = lib.licenses.agpl3Only;
  };
  themes.geist = stdenv.mkDerivation rec {
    pname = "geist";
    version = "2.0.3";
    src = fetchzip {
      inherit version;
      name = pname;
      url = "https://github.com/christophery/geist/archive/refs/tags/${version}.zip";
      hash = "sha256-c85oRhqu5E5IJlpgqKJRQITur1W7x40obOvHZbPevzU=";
    };
    meta.license = lib.licenses.gpl2Only;
  };
}
+5 −5
Original line number Diff line number Diff line
[
  "de_DE"
, "fr_FR"
, "ro_RO"
]
{
  "de_DE": "gpl2Plus"
, "fr_FR": "gpl2Plus"
, "ro_RO": "gpl2Plus"
}
+38 −38
Original line number Diff line number Diff line
[
  "add-widget-after-content"
, "akismet"
, "antispam-bee"
, "async-javascript"
, "breeze"
, "code-syntax-block"
, "cookie-notice"
, "co-authors-plus"
, "disable-xml-rpc"
, "embed-extended"
, "gutenberg"
, "hello-dolly"
, "hkdev-maintenance-mode"
, "jetpack"
, "jetpack-lite"
, "lightbox-photoswipe"
, "login-lockdown"
, "mailpoet"
, "merge-minify-refresh"
, "opengraph"
, "simple-login-captcha"
, "simple-mastodon-verification"
, "static-mail-sender-configurator"
, "tc-custom-javascript"
, "webp-converter-for-media"
, "webp-express"
, "wordpress-seo"
, "worker"
, "wp-change-email-sender"
, "wp-fastest-cache"
, "wp-gdpr-compliance"
, "wp-mail-smtp"
, "wp-statistics"
, "wp-swiper"
, "wp-user-avatars"
, "wpforms-lite"
]
{
  "add-widget-after-content": "gpl3Plus"
, "akismet": "gpl2Plus"
, "antispam-bee": "gpl2Plus"
, "async-javascript": "gpl2Plus"
, "breeze": "gpl2Plus"
, "code-syntax-block": "gpl2Plus"
, "cookie-notice": "mit"
, "co-authors-plus": "gpl2Plus"
, "disable-xml-rpc": "gpl2Plus"
, "embed-extended": "gpl2Plus"
, "gutenberg": "gpl2Plus"
, "hello-dolly": "gpl2Plus"
, "hkdev-maintenance-mode": "gpl2Plus"
, "jetpack": "gpl2Plus"
, "jetpack-lite": "gpl2Only"
, "lightbox-photoswipe": "gpl2Only"
, "login-lockdown": "gpl2Plus"
, "mailpoet": "gpl3Only"
, "merge-minify-refresh": "gpl2Plus"
, "opengraph": "asl20"
, "simple-login-captcha": "gpl2Plus"
, "simple-mastodon-verification": "gpl2Plus"
, "static-mail-sender-configurator": "mit"
, "tc-custom-javascript": "gpl2Plus"
, "webp-converter-for-media": "gpl2Plus"
, "webp-express": "gpl3Only"
, "wordpress-seo": "gpl3Only"
, "worker": "gpl3Plus"
, "wp-change-email-sender": "gpl2Plus"
, "wp-fastest-cache": "gpl2Plus"
, "wp-gdpr-compliance": "gpl2Plus"
, "wp-mail-smtp": "gpl3Plus"
, "wp-statistics": "gpl3Only"
, "wp-swiper": "gpl2Plus"
, "wp-user-avatars": "gpl2Plus"
, "wpforms-lite": "gpl2Plus"
}
Loading