aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2023-03-21 15:18:04 -0300
committerEuAndreh <eu@euandre.org>2023-03-21 15:18:04 -0300
commit31c5b9454b5c8be82772c10a5fdf4a1bc1074112 (patch)
tree4b959567f2ae6361c7c0c1012c91bedc8ebc1ccc
parentsrc/bin/paku: Turn value of $dir into Make variable $(DIR) (diff)
downloadpackage-repository-31c5b9454b5c8be82772c10a5fdf4a1bc1074112.tar.gz
package-repository-31c5b9454b5c8be82772c10a5fdf4a1bc1074112.tar.xz
src/bin/paku: First-ish version of HTML output
-rw-r--r--paku.lock1
-rwxr-xr-xsrc/bin/paku172
2 files changed, 173 insertions, 0 deletions
diff --git a/paku.lock b/paku.lock
index f89a9fb..4ac3b22 100644
--- a/paku.lock
+++ b/paku.lock
@@ -12,6 +12,7 @@
},
"namespace": "org.euandre",
"maintainer": "EuAndreh <eu@euandre.org>",
+ "name": "EuAndreh",
"packages": [
{
"name": "git-permalink",
diff --git a/src/bin/paku b/src/bin/paku
index 8acb991..6ba6d04 100755
--- a/src/bin/paku
+++ b/src/bin/paku
@@ -88,6 +88,18 @@ my $json = JSON::decode_json($json_str);
my $action = $ARGV[0] or die "Missing ACTION";
+sub pretty_version($pkg) {
+ if ($pkg->{type} eq 'latest') {
+ return ('latest', '');
+ } else {
+ my $ver = $pkg->{version};
+ $ver =~ s/^v//;
+ $ver =~ s/\./-/g;
+ return ($ver, "-$ver");
+ }
+}
+
+
sub emit_release() {
my $f = $ARGV[1];
my $name = File::Basename::basename $f;
@@ -434,7 +446,167 @@ sub emit_debian() {
}
sub emit_html() {
+ print <<~EOF;
+ <!DOCTYPE html>
+ <html lang="en">
+ <head>
+ <meta charset="UTF-8" />
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
+ <link rel="icon" type="image/svg+html" href="favicon.svg" />
+ <title>$json->{name} package index</title>
+
+ <style>
+ body {
+ max-width: 800px;
+ margin: 0 auto;
+ }
+
+ ul {
+ list-style: none;
+ }
+
+ li {
+ margin-top: 2em;
+ }
+ </style>
+ </head>
+ <body>
+ <main>
+ <h1>
+ $json->{name} package index
+ </h1>
+ <ul>
+ EOF
+
+ for my $pkg (@{$json->{packages}}) {
+ my ($ver, $suffix) = pretty_version $pkg;
+ my $apt_suffix = $suffix eq '' ? '' : "=$ver";
+ print <<~EOF;
+ <li id="$pkg->{name}-$ver">
+ <details>
+ <summary>
+ <a href="#$pkg->{name}-$ver">$pkg->{name}</a>
+ ($ver) - $pkg->{description}
+ </summary>
+ <p>
+ <a href="$pkg->{'base-url'}/">Homepage</a>
+ </p>
+ <section>
+ <h2>Guix</h2>
+ <p>
+ After following the
+ <a href="#guix-instructions">Guix instructions</a>
+ to include this channel, you can launch a shell
+ that includes this package:
+ </p>
+ <pre><code>\$ guix shell $pkg->{name}$suffix</code></pre>
+ <p>
+ Alternatively, you can install it imperatively:
+ </p>
+ <pre><code>\$ guix install $pkg->{name}$suffix</code></pre>
+ </section>
+ <section>
+ <h2>Debian</h2>
+ <p>
+ After following the
+ <a href="#debian-instructions">Debian instructions</a>
+ to include this repository to
+ <code>/etc/apt/sources.list</code>, you can
+ install it:
+ </p>
+ <pre><code># apt install $pkg->{name}$apt_suffix</code></pre>
+ </section>
+ <section>
+ <h2>Nix</h2>
+ <p>
+ After following the
+ <a href="#nix-instructions">Nix instructions</a>
+ to include this repository as an overlay, you
+ can launch a shell that includes this package:
+ </p>
+ <pre><code>\$ nix-shell -p $pkg->{name}$suffix</code></pre>
+ <p>
+ Alternatively, you can install it imperatively:
+ </p>
+ <pre><code>\$ nix-env -i $pkg->{name}$suffix</code></pre>
+ </section>
+ </details>
+ </li>
+ EOF
+ }
+ print <<~EOF;
+ </ul>
+ <article id="guix-instructions">
+ <h2>Guix instructions</h2>
+ <p>
+ Add this channel to your
+ <code>~/.config/guix/channels.scm</code>:
+ </p>
+ <pre><code>(cons*
+ (channel
+ (name 'org-euandre)
+ (url "git://euandre.org/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>
+ Afterwards, do a <code>guix pull</code> to make the
+ packages in this channel available to your profile.
+ </p>
+ <p>
+ See also the
+ <a href="https://guix.gnu.org/manual/en/guix.html#Channels">Guix manual on channels</a>
+ for more information.
+ </p>
+ </article>
+ <article id="debian-instructions">
+ <h2>Debian instructions</h2>
+ <p>
+ Include my public key for validating the repository
+ signatures:
+ <code>~/.config/guix/channels.scm</code>:
+ </p>
+ <pre><code>\$ wget -qO- https://euandre.org/s/package-repository/debian/public-key.asc | sudo tee /etc/apt/trusted.gpg.d/euandre.org.asc</code></pre>
+ <p>
+ Afterwards, include this repository to the list of
+ repositories that <code>apt</code> uses for sources
+ by adding its URL to
+ <code>/etc/apt/sources.list</code>:
+ </p>
+ <pre><code>\$ sudo apt-add-repository 'deb https://euandre.org/s/package-repository/debian ./'</code></pre>
+ <p>
+ <code>apt-add-repository</code> will already perform
+ an <code>apt update</code>, so the packages from the
+ new repository will already be available.
+ </p>
+ </article>
+ <article id="nix-instructions">
+ <h2>Nix instructions</h2>
+ <p>
+ Add this repository as an overlay to your
+ <code>/etc/nixos/configuration.nix</code>:
+ </p>
+ <pre><code> nixpkgs = {
+ overlays = [
+ (import (fetchTarball {
+ url = "https://euandre.org/git/package-repository/snapshot/package-repository-main.tar.gz";
+ }) { inherit pkgs; })
+ ];
+ };</code></pre>
+ <p>
+ All the packages live under the
+ <code>org-euandre</code> attribute set.
+ </p>
+ </article>
+ </main>
+ </body>
+ </html>
+ EOF
}