wordpressPackages: add license information

This commit is contained in:
Jonas Heinrich 2024-01-31 10:44:46 +01:00
parent aacf584689
commit 37d0a57684
6 changed files with 87 additions and 66 deletions

View file

@ -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 {})

View file

@ -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

View file

@ -1,14 +1,25 @@
{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";
hash = "sha256-XsNFxVL0LF+OHlsqjjTV41x9ERLwMDq9BnKKP3Px2aI=";
src = fetchzip {
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 {
name = "geist";
themes.geist = stdenv.mkDerivation rec {
pname = "geist";
version = "2.0.3";
url = "https://github.com/christophery/geist/archive/refs/tags/${version}.zip";
hash = "sha256-c85oRhqu5E5IJlpgqKJRQITur1W7x40obOvHZbPevzU=";
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;
};
}

View file

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

View file

@ -1,38 +1,38 @@
[
"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"
}

View file

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