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

wordpressPackages: add license information
This commit is contained in:
Jonas Heinrich 2024-02-05 13:00:22 +01:00 committed by GitHub
commit 4c7c79948e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 87 additions and 66 deletions

View file

@ -9,12 +9,17 @@ let packages = self:
generatedJson = { generatedJson = {
inherit plugins themes languages; 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 { in {
# Create a generic WordPress package. Most arguments are just passed # Create a generic WordPress package. Most arguments are just passed
# to `mkDerivation`. The version is automatically filtered for weird characters. # to `mkDerivation`. The version is automatically filtered for weird characters.
mkWordpressDerivation = self.callPackage ({ stdenvNoCC, lib, filterWPString, gettext, wp-cli }: 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" ]; assert lib.any (x: x == type) [ "plugin" "theme" "language" ];
stdenvNoCC.mkDerivation ({ stdenvNoCC.mkDerivation ({
pname = "wordpress-${type}-${pname}"; pname = "wordpress-${type}-${pname}";
@ -31,6 +36,10 @@ let packages = self:
passthru = { passthru = {
wpName = pname; wpName = pname;
};
meta = {
license = lib.licenses.${license};
} // (args.passthru or {}); } // (args.passthru or {});
} // lib.optionalAttrs (type == "language") { } // lib.optionalAttrs (type == "language") {
nativeBuildInputs = [ gettext wp-cli ]; nativeBuildInputs = [ gettext wp-cli ];
@ -51,9 +60,9 @@ let packages = self:
# Create a derivation from the official wordpress.org packages. # Create a derivation from the official wordpress.org packages.
# This takes the type, the pname and the data generated from the go tool. # This takes the type, the pname and the data generated from the go tool.
mkOfficialWordpressDerivation = self.callPackage ({ mkWordpressDerivation, fetchWordpress }: mkOfficialWordpressDerivation = self.callPackage ({ mkWordpressDerivation, fetchWordpress }:
{ type, pname, data }: { type, pname, data, license }:
mkWordpressDerivation { mkWordpressDerivation {
inherit type pname; inherit type pname license;
version = data.version; version = data.version;
src = fetchWordpress type data; src = fetchWordpress type data;
@ -79,7 +88,8 @@ let packages = self:
throw "fetchWordpress: invalid package type ${type}"; 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. # This creates an extensible scope.
in lib.recursiveUpdate ((lib.makeExtensible (_: (lib.makeScope newScope packages))).extend (selfWP: superWP: {})) (callPackage ./thirdparty.nix {}) in lib.recursiveUpdate ((lib.makeExtensible (_: (lib.makeScope newScope packages))).extend (selfWP: superWP: {})) (callPackage ./thirdparty.nix {})

View file

@ -12,9 +12,9 @@ nixFlags="--option experimental-features nix-command eval --raw --impure --expr"
export NIX_PATH=nixpkgs=../../../../.. export NIX_PATH=nixpkgs=../../../../..
export WP_VERSION=$(nix $nixFlags '(import <nixpkgs> {}).wordpress.version') export WP_VERSION=$(nix $nixFlags '(import <nixpkgs> {}).wordpress.version')
PLUGINS=`cat wordpress-plugins.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 '.[]' | 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 '.[]' | 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 -p $PLUGINS -pl en
wp4nix -t $THEMES -tl en wp4nix -t $THEMES -tl en

View file

@ -1,14 +1,25 @@
{fetchzip}: { {fetchzip, stdenv, lib}: {
plugins.civicrm = fetchzip rec { plugins.civicrm = stdenv.mkDerivation rec {
name = "civicrm"; pname = "civicrm";
version = "5.56.0"; version = "5.56.0";
url = "https://storage.googleapis.com/${name}/${name}-stable/${version}/${name}-${version}-wordpress.zip"; src = fetchzip {
hash = "sha256-XsNFxVL0LF+OHlsqjjTV41x9ERLwMDq9BnKKP3Px2aI="; inherit version;
name = pname;
url = "https://storage.googleapis.com/${pname}/${pname}-stable/${version}/${pname}-${version}-wordpress.zip";
hash = "sha256-XsNFxVL0LF+OHlsqjjTV41x9ERLwMDq9BnKKP3Px2aI=";
};
meta.license = lib.licenses.agpl3Only;
}; };
themes.geist = fetchzip rec { themes.geist = stdenv.mkDerivation rec {
name = "geist"; pname = "geist";
version = "2.0.3"; version = "2.0.3";
url = "https://github.com/christophery/geist/archive/refs/tags/${version}.zip"; src = fetchzip {
hash = "sha256-c85oRhqu5E5IJlpgqKJRQITur1W7x40obOvHZbPevzU="; inherit version;
name = pname;
url = "https://github.com/christophery/geist/archive/refs/tags/${version}.zip";
hash = "sha256-c85oRhqu5E5IJlpgqKJRQITur1W7x40obOvHZbPevzU=";
};
meta.license = lib.licenses.gpl2Only;
}; };
} }

View file

@ -1,5 +1,5 @@
[ {
"de_DE" "de_DE": "gpl2Plus"
, "fr_FR" , "fr_FR": "gpl2Plus"
, "ro_RO" , "ro_RO": "gpl2Plus"
] }

View file

@ -1,38 +1,38 @@
[ {
"add-widget-after-content" "add-widget-after-content": "gpl3Plus"
, "akismet" , "akismet": "gpl2Plus"
, "antispam-bee" , "antispam-bee": "gpl2Plus"
, "async-javascript" , "async-javascript": "gpl2Plus"
, "breeze" , "breeze": "gpl2Plus"
, "code-syntax-block" , "code-syntax-block": "gpl2Plus"
, "cookie-notice" , "cookie-notice": "mit"
, "co-authors-plus" , "co-authors-plus": "gpl2Plus"
, "disable-xml-rpc" , "disable-xml-rpc": "gpl2Plus"
, "embed-extended" , "embed-extended": "gpl2Plus"
, "gutenberg" , "gutenberg": "gpl2Plus"
, "hello-dolly" , "hello-dolly": "gpl2Plus"
, "hkdev-maintenance-mode" , "hkdev-maintenance-mode": "gpl2Plus"
, "jetpack" , "jetpack": "gpl2Plus"
, "jetpack-lite" , "jetpack-lite": "gpl2Only"
, "lightbox-photoswipe" , "lightbox-photoswipe": "gpl2Only"
, "login-lockdown" , "login-lockdown": "gpl2Plus"
, "mailpoet" , "mailpoet": "gpl3Only"
, "merge-minify-refresh" , "merge-minify-refresh": "gpl2Plus"
, "opengraph" , "opengraph": "asl20"
, "simple-login-captcha" , "simple-login-captcha": "gpl2Plus"
, "simple-mastodon-verification" , "simple-mastodon-verification": "gpl2Plus"
, "static-mail-sender-configurator" , "static-mail-sender-configurator": "mit"
, "tc-custom-javascript" , "tc-custom-javascript": "gpl2Plus"
, "webp-converter-for-media" , "webp-converter-for-media": "gpl2Plus"
, "webp-express" , "webp-express": "gpl3Only"
, "wordpress-seo" , "wordpress-seo": "gpl3Only"
, "worker" , "worker": "gpl3Plus"
, "wp-change-email-sender" , "wp-change-email-sender": "gpl2Plus"
, "wp-fastest-cache" , "wp-fastest-cache": "gpl2Plus"
, "wp-gdpr-compliance" , "wp-gdpr-compliance": "gpl2Plus"
, "wp-mail-smtp" , "wp-mail-smtp": "gpl3Plus"
, "wp-statistics" , "wp-statistics": "gpl3Only"
, "wp-swiper" , "wp-swiper": "gpl2Plus"
, "wp-user-avatars" , "wp-user-avatars": "gpl2Plus"
, "wpforms-lite" , "wpforms-lite": "gpl2Plus"
] }

View file

@ -1,7 +1,7 @@
[ {
"twentynineteen" "twentynineteen": "gpl2Plus"
, "twentytwenty" , "twentytwenty": "gpl2Plus"
, "twentytwentytwo" , "twentytwentytwo": "gpl2Plus"
, "twentytwentyone" , "twentytwentyone": "gpl2Plus"
, "twentytwentythree" , "twentytwentythree": "gpl2Plus"
] }