initial commit

This commit is contained in:
John Bowdre 2024-03-03 16:34:46 -06:00
commit 93d3e32ef1
10 changed files with 171 additions and 0 deletions

3
.envrc Normal file
View file

@ -0,0 +1,3 @@
#!/usr/bin/env direnv
use flake .

3
.gitignore vendored Normal file
View file

@ -0,0 +1,3 @@
/.certificates/
/.direnv/
/public/

27
flake.lock Normal file
View file

@ -0,0 +1,27 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1709237383,
"narHash": "sha256-cy6ArO4k5qTx+l5o+0mL9f5fa86tYUX3ozE1S+Txlds=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "1536926ef5621b09bba54035ae2bb6d806d72ac8",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

33
flake.nix Normal file
View file

@ -0,0 +1,33 @@
{
description = "gemsite build environment";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
};
outputs = { self, nixpkgs }:
let
pkgs = import nixpkgs { system = "x86_64-linux"; };
gempost = pkgs.rustPlatform.buildRustPackage rec {
pname = "gempost";
version = "v0.3.0";
src = pkgs.fetchFromGitHub {
owner = "justlark";
repo = pname;
rev = version;
hash = "sha256-T6CP1blKXik4AzkgNJakrJyZDYoCIU5yaxjDvK3p01U=";
};
cargoHash = "sha256-jG/G/gmaCGpqXeRQX4IqV/Gv6i/yYUpoTC0f7fMs4pQ=";
};
in
{
devShells.x86_64-linux.default = pkgs.mkShell {
packages = with pkgs; [
agate
gempost
];
};
};
}

3
gemlog/hello-world.gmi Normal file
View file

@ -0,0 +1,3 @@
Hello, world!
This is an example gemlog post.

15
gemlog/hello-world.yaml Normal file
View file

@ -0,0 +1,15 @@
#
# This is an example of a YAML sidecar metadata file.
#
# A universally unique URI that will never change. We recommend using a UUID.
id: "urn:uuid:f82846da-b32a-4e77-9ce1-4be99da99292"
# The title of your post.
title: "Hello World"
# When your post was originally published.
published: "2024-03-03T15:44:28-06:00"
# When your post was last updated.
updated: "2024-03-03T15:44:28-06:00"

54
gempost.yaml Normal file
View file

@ -0,0 +1,54 @@
# The directory to generate the capsule at (required).
public_dir: "./public/"
# The directory for static assets that are copied to the generated capsule
# verbatim (required).
static_dir: "./static/"
# The directory for gemtext gemlog posts and their sidecar metadata files
# (required).
posts_dir: "./gemlog/"
# The path of the Tera template used to generate the gemlog index page
# (required).
index_template_file: "./templates/index.tera"
# The path of the Tera template used to generate each gemlog post page
# (required).
post_template_file: "./templates/post.tera"
# A Tera template which specifies the URL path for posts (required).
#
# This template has access to the following variables:
# - `year`: The four-digit year of publication, if a publication date was provided
# - `month`: The two-digit month of publication, if a publication date was provided
# - `day`: The two-digit day of publication, if a publication date was provided
# - `slug`: The name of the gemtext source file, sans file extension
#
# Docs for the Tera templating language:
# https://keats.github.io/tera/docs/#templates
post_path: "/gemlog/{{ year }}-{{ month }}-{{ day }}-{{ slug }}.gmi"
# The URL path of the index page for your gemlog (required).
index_path: "/gemlog/index.gmi"
# The URL path to serve your capsule's Atom feed at (required).
feed_path: "/gemlog/atom.xml"
# The title of your gemlog (required).
title: "John's Capsule"
# The gemini:// URL of your capsule's homepage (required).
url: "gemini://gem.jbowdre.lol"
# A subtitle for your gemlog (optional).
subtitle: "My personal gemlog about cool stuff"
# The copyright and licensing information for your gemlog (optional).
rights: "CC BY-SA"
# The primary author of your gemlog (optional).
author:
name: "John Bowdre" # Required
email: "jbowdre@omg.lol" # Optional
uri: "gemini://gem.jbowdre.lol" # Optional

5
static/index.gmi Normal file
View file

@ -0,0 +1,5 @@
# John's Capsule
This is an example homepage for your capsule.
=> /gemlog Gemlog

20
templates/index.tera Normal file
View file

@ -0,0 +1,20 @@
{#
This is an example of a Tera template for your gemlog's index page.
This example formats your index page in the standard gemsub format that
Gemini clients can subscribe to. Note that gempost already generates an Atom
feed that clients should be able to subscribe to.
Here is the documentation for the gemsub format:
https://geminiprotocol.net/docs/companion/subscription.gmi
#}# {{ feed.title }}
{% if feed.subtitle -%}
## {{ feed.subtitle }}
{% endif -%}
{% for entry in feed.entries -%}
=> {{ entry.url }} {{ entry.updated | date(format="%Y-%m-%d") }} - {{ entry.title }}
{% endfor %}
=> {{ feed.feed_url }} Atom feed

8
templates/post.tera Normal file
View file

@ -0,0 +1,8 @@
{#
This is an example of a Tera template for each individual post.
This is a minimal example that just adds a header with the title from the
sidecar YAML metadata file.
#}# {{ entry.title }}
{{ entry.body }}