aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2021-06-17 01:45:01 -0300
committerEuAndreh <eu@euandre.org>2021-06-17 01:45:34 -0300
commit4b1a6ef78bd9857e915d2c1600fbbc89ebeb1b1e (patch)
tree567aa4d2d9b5f418e13efc2a32ceb482f0f31cdb /scripts
parentTODOs.md: Add #task-df240b87-016a-12e8-55fc-745056f284da (diff)
downloadpackage-repository-4b1a6ef78bd9857e915d2c1600fbbc89ebeb1b1e.tar.gz
package-repository-4b1a6ef78bd9857e915d2c1600fbbc89ebeb1b1e.tar.xz
scripts/paku: Generate paku.html
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/paku116
1 files changed, 115 insertions, 1 deletions
diff --git a/scripts/paku b/scripts/paku
index 3c9e793..939db80 100755
--- a/scripts/paku
+++ b/scripts/paku
@@ -232,12 +232,123 @@ refresh_packages() {
else
NEW_VERSION="$(git describe --tags --abbrev=0 | cut -c2-)"
fi
+ DESCRIPTION="$(cat description)"
cd - >/dev/null
jq -r ".packages[$N].version = \"$NEW_VERSION\"" paku.json | sponge paku.json
+ jq -r ".packages[$N].description = \"$DESCRIPTION\"" paku.json | sponge paku.json
done
}
-while getopts 'gr' flag; do
+report_index() {
+ cat <<EOF > paku.html
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <meta charset="UTF-8" />
+ <meta name="viewport" content="width=device-width, initial-scale=" />
+ <link rel="icon" type="image/svg+html" href="favicon.svg" />
+ <title>Package index</title>
+
+ <style>
+ ul {
+ list-style: none;
+ }
+ li {
+ margin-top: 30px;
+ }
+ </style>
+ </head>
+ <body>
+ <h1>
+ Package index
+ </h1>
+ <ul>
+EOF
+
+ for p in $(jq -r '.packages[] | @base64' < paku.json); do
+ NAME="$(echo "$p" | base64 --decode | jq -r '.name')"
+ DESCRIPTION="$(echo "$p" | base64 --decode | jq -r '.description')"
+ SUFFIX="$(echo "$p" | base64 --decode | jq -r '.suffix')"
+ if [ -z "$SUFFIX" ]; then
+ VERSION="$(echo "$p" | base64 --decode | jq -r '.version')"
+ ID='released'
+ else
+ VERSION='latest'
+ ID='latest'
+ fi
+
+ cat <<EOF >> paku.html
+ <li id="$NAME-$ID">
+ <details>
+ <summary><a href="#$NAME-$ID">$NAME</a> ($VERSION) - $DESCRIPTION</summary>
+ <p>
+ <a href="https://euandreh.xyz/$NAME/">Homepage</a>.
+ </p>
+
+ <section>
+ <h2>
+ Guix
+ </h2>
+ <p>
+ Add this channel to your Add this channel to your <code>~/.config/guix/channels.scm</code>:
+ </p>
+ <pre><code>(cons*
+ (channel
+ (name 'xyz-euandreh)
+ (url "git://euandreh.xyz/package-repository")
+ (branch "main")
+ (introduction
+ (make-channel-introduction
+ "d749e053e6db365069cb9b2ef47a78b06f9e7361"
+ (openpgp-fingerprint
+ "5BDA E9B8 B2F6 C6BC BB0D 6CE5 81F9 0EC3 CD35 6060"))))
+ %default-channels)</code></pre>
+ <p>
+ Now you can create a new Guix environment that includes this package:
+ </p>
+ <pre><code>$ guix environment --ad-hoc $NAME$SUFFIX</code></pre>
+ <p>
+ Alternatively, you can install it imperatively:
+ </p>
+ <pre><code>$ guix install $NAME$SUFFIX</code></pre>
+ </section>
+
+ <section>
+ <h2>
+ Nix
+ </h2>
+ <p>
+ Add the overlay to your <code>/etc/nixox/configuration.nix</code>:
+ </p>
+ <pre></code>nixpkgs = {
+ overlays = [
+ (import (fetchTarball {
+ url = "https://git.euandreh.xyz/package-repository/snapshot/package-repository-main.tar.gz";
+ }) { inherit pkgs; })
+ ];
+};</code></pre>
+ <p>
+ Now you can create a new Nix shell that includes this package:
+ </p>
+ <pre><code>$ nix-shell -p $NAME$SUFFIX</code></pre>
+ <p>
+ Alternatively, you can install it imperatively:
+ </p>
+ <pre><code>$ nix-env -i $NAME$SUFFIX</code></pre>
+ </section>
+ </details>
+ </li>
+EOF
+ done
+
+ cat <<EOF >> paku.html
+ </ul>
+ </body>
+</html>
+EOF
+}
+
+while getopts 'grl' flag; do
case "$flag" in
g)
gen_guix
@@ -247,6 +358,9 @@ while getopts 'gr' flag; do
r)
refresh_packages
;;
+ l)
+ report_index
+ ;;
*)
printf 'Unrecognized flag "%s".\n' "$flag" >&2
;;