Something went wrong. Try again.
What happens if I push all of nixpkgs
Something went wrong. Try again.
Nix
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208# Source: https://git.helsinki.tools/helsinki-systems/wp4nix/-/blob/master/default.nix# Licensed under: MIT# Slightly modified
{ lib, newScope, plugins, themes, languages, callPackage,}:
let packages = self: let 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, license, ... }@args: assert lib.any (x: x == type) [ "plugin" "theme" "language" ]; stdenvNoCC.mkDerivation ( { pname = "wordpress-${type}-${pname}"; version = filterWPString version;
dontConfigure = true; dontBuild = true;
installPhase = '' runHook preInstall cp -R ./. $out runHook postInstall '';
passthru = { wpName = pname; };
meta = { license = lib.licenses.${license}; } // (args.passthru or { }); } // lib.optionalAttrs (type == "language") { nativeBuildInputs = [ gettext wp-cli ]; dontBuild = false; buildPhase = '' runHook preBuild
find -name '*.po' -print0 | while IFS= read -d "" -r po; do msgfmt -o $(basename "$po" .po).mo "$po" done wp i18n make-json . rm *.po
runHook postBuild ''; } // removeAttrs args [ "type" "pname" "version" "passthru" ] ) ) { };
# 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, license, }: mkWordpressDerivation { inherit type pname license; version = data.version;
src = fetchWordpress type data; } ) { };
# Filter out all characters that might occur in a version string but that that are not allowed # in store paths. filterWPString = builtins.replaceStrings [ " " "," "/" "&" ";" ''"'' "'" "$" ":" "(" ")" "[" "]" "{" "}" "|" "*" "\t" ] [ "_" "." "." "" "" "" "" "" "" "" "" "" "" "" "" "-" "" "" ];
# Fetch a package from the official wordpress.org SVN. # The data supplied is the data straight from the go tool. fetchWordpress = self.callPackage ( { fetchsvn }: type: data: fetchsvn { inherit (data) rev sha256; url = if type == "plugin" || type == "theme" then "https://" + type + "s.svn.wordpress.org/" + data.path else if type == "language" then "https://i18n.svn.wordpress.org/core/" + data.version + "/" + data.path else if type == "pluginLanguage" then "https://i18n.svn.wordpress.org/plugins/" + data.path else if type == "themeLanguage" then "https://i18n.svn.wordpress.org/themes/" + data.path else throw "fetchWordpress: invalid package type ${type}"; } ) { };
} // lib.mapAttrs ( type: pkgs: lib.recurseIntoAttrs ( lib.makeExtensible ( _: lib.mapAttrs ( pname: data: self.mkOfficialWordpressDerivation { type = lib.removeSuffix "s" type; inherit pname data; license = sourceJson.${type}.${pname}; } ) pkgs ) ) ) generatedJson;
in# This creates an extensible scope.lib.recursiveUpdate ((lib.makeExtensible (_: (lib.makeScope newScope packages))).extend ( selfWP: superWP: { })) (callPackage ./thirdparty.nix { })