Merge pull request 'add sempress theme' (#137) from add-sempress-theme into main
Some checks failed
Hydra wordpress-themes.sempress Hydra build #29918 of nix-packages:x86_64-linux-master:wordpress-themes.sempress
Hydra element-web Hydra build #29701 of nix-packages:aarch64-linux-master:element-web
ci/woodpecker/cron/update-lockfile Pipeline was successful
ci/woodpecker/cron/update Pipeline failed

Reviewed-on: #137
This commit is contained in:
Charlotte 🦝 Delenk 2023-04-27 09:37:39 +00:00
commit 00180b2868
Signed by: gitea-bot
GPG key ID: C9974EDF9932B558
8 changed files with 57 additions and 0 deletions

View file

@ -119,4 +119,5 @@ matrix:
- element-web - element-web
- woodpecker-server - woodpecker-server
- wordpress-plugins - wordpress-plugins
- wordpress-themes
skip_clone: true skip_clone: true

View file

@ -69,6 +69,7 @@ in
hydra hydra
hydra-unstable hydra-unstable
wordpress-plugins wordpress-plugins
wordpress-themes
; ;
} }
// ( // (

View file

@ -112,6 +112,7 @@
hydra hydra
hydra-unstable hydra-unstable
wordpress-plugins wordpress-plugins
wordpress-themes
; ;
} }
// ( // (

View file

@ -83,6 +83,7 @@ system: self: super: let
}); });
hydra-unstable = self.hydra; hydra-unstable = self.hydra;
wordpress-plugins = self.callPackage ./web/wordpress-plugins {}; wordpress-plugins = self.callPackage ./web/wordpress-plugins {};
wordpress-themes = self.callPackage ./web/wordpress-themes {};
}) })
riscv-overlay riscv-overlay
]; ];

View file

@ -0,0 +1,33 @@
{
stdenv,
fetchurl,
lib,
unzip,
}:
with builtins;
with lib; let
themes = lists.init (splitString "\n" (readFile ./themes));
in
listToAttrs (map (name: {
inherit name;
value = let
source = importJSON ./${name}.json;
in
stdenv.mkDerivation {
inherit (source) pname version;
src = fetchurl {
inherit (source) url sha256;
};
nativeBuildInputs = [unzip];
unpackPhase = ''
unzip $src
'';
installPhase = "mkdir -p $out; cp -R $pname/* $out/";
meta = {inherit (source) description;};
passthru.updateScript =
if name == "activitypub"
then ./update.sh
else [];
};
})
themes)

View file

@ -0,0 +1,7 @@
{
"version": "1.7.0",
"pname": "sempress",
"description": "SemPress",
"url": "https://downloads.wordpress.org/theme/sempress.1.7.0.zip",
"sha256": "130c9c76c1db0f54ec21c318dad11498777e6ccb73df0f3cd3554f7c2ca07ad2"
}

View file

@ -0,0 +1 @@
sempress

12
web/wordpress-themes/update.sh Executable file
View file

@ -0,0 +1,12 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p curl jq
cd web/workpress-themes
set -ex
for plugin in $(cat themes); do
META=$(curl https://api.wordpress.org/themes/info/1.1/?action\=theme_information\&request\\\[slug\\\]\=$plugin)
SHA256=$(curl $(echo $META | jq -r '.download_link') | sha256sum | awk '{print $1}')
echo $META | jq '{"version": .version, "pname": .slug, "description": .name, "url": .download_link, "sha256": $SHA256}' --arg SHA256 $SHA256 > $plugin.json
done