reafactor and cleanup

- remove gemini for now
- get css from nix-colors.m7.rs
- cleanup
This commit is contained in:
Gabriel Fontes
2022-11-02 20:47:05 -03:00
parent 8144c0bb69
commit 68d4aeda17
34 changed files with 55 additions and 392 deletions
+1
View File
@@ -1,3 +1,4 @@
_src/_sass/vendor liguist-vendored
nix/gemset.nix liguist-generated
Gemfile.lock liguist-generated
+3 -10
View File
@@ -1,12 +1,5 @@
result
_src/_includes/scheme-datalist.html
_src/assets/themes
.certificates
.sass-cache/
.jekyll-cache/
_site
.jekyll-cache
.jekyll-metadata
_site/
.sass-cache
+1 -1
View File
@@ -4,7 +4,7 @@
[![built with nix](https://img.shields.io/static/v1?logo=nixos&logoColor=white&label=&message=Built%20with%20Nix&color=41439a)](https://nixos.org)
[![hydra status](https://hydra.m7.rs/shield/job/website/main/x86_64-linux.main)](https://hydra.m7.rs/jobset/website/main)
My personal website and gemini capsule.
My personal website.
Licensed under MIT (code) and CC BY-SA 4.0 (content), available at both
[my cgit](https://m7.rs/git/website/about) and
+3 -25
View File
@@ -3,6 +3,7 @@ description: "My personal website and projects"
domain: "m7.rs"
default_theme: catppuccin
themes_url: //nix-colors.m7.rs/css
plugins:
- jekyll-extlinks
@@ -34,46 +35,23 @@ collections:
name: Posts
defaults:
# Set HTML layouts
# Set layouts
-
scope:
path: ""
type: "posts"
values:
layout: "post.html"
gemini: false
-
scope:
path: ""
values:
layout: "default.html"
gemini: false
# Set gemini layouts
-
scope:
path: "**/*.gmi"
type: "posts"
values:
layout: "post.gmi"
gemini: true
-
scope:
path: "**/*.gmi"
values:
layout: "default.gmi"
gemini: true
# Post default metadata
# Default metadata
-
scope:
path: ""
values:
language: "en"
author: "Gabriel Fontes"
# All markdown pages have a gemini version, by default
-
scope:
path: "**/*.md"
values:
has_gemini: true
@@ -1,6 +0,0 @@
#!/usr/bin/env bash
openring -S <( yq -r '.[].feed' blogs.yml ) \
-n 5 \
< webring-in.yml \
> webring.yml
@@ -0,0 +1,2 @@
#!/usr/bin/env bash
@@ -1,8 +0,0 @@
{{range .Articles}}
- title: "{{.Title}}"
link: "{{.Link}}"
date: "{{.Date}}"
summary: "{{.Summary}}"
sourcelink: "{{.SourceLink}}"
sourcetitle: "{{.SourceTitle}}"
{{end}}
+2
View File
@@ -1,4 +1,5 @@
- title: "October 2022"
link: "http://lazybear.io/posts/october-2022/"
date: "2022-10-31 00:30:00 &#43;0100 &#43;0100"
@@ -47,3 +48,4 @@ from OS hacking …"
sourcelink: "https://joelchrono12.xyz/"
sourcetitle: "Joelchrono12"
@@ -2,7 +2,6 @@
title: NixOS + home-manager on BTRFS with opt-in state
description: About my opt-in state NixOS and home-manager setups
tags: nix
draft: true
---
There's a few blog posts about how opt-in persistence makes NixOS/home-manager
@@ -1,9 +0,0 @@
Wanna talk? Hit me up on email. Feel free to encrypt, and use plaintext if possible.
=> mailto:gabriel@gsfontes.com gabriel@gsfontes.com
=> mailto:hi@m7.rs hi@m7.rs
=> mailto:g.fontes@usp.br g.fontes@usp.br
=> /7088C7421873E0DB97FF17C2245CAB70B4C225E9.asc PGP: 7088 C742 1873 E0DB 97FF 17C2 245C AB70 B4C2 25E9
This site's code is available under MIT, while its content is CC BY-SA 4.0
=> https://m7.rs/git/website/about Repository
@@ -1,4 +0,0 @@
Gabriel Fontes
{% for item in site.data.navigation %}
=> {{ item.link }} {{ item.name }}
{%- endfor -%}
@@ -13,13 +13,4 @@
</li>
{% endfor %}
</ul>
<p>
<small>
{% if page.has_gemini %}
Also available <a href="gemini://{{ site.domain }}{{ page.url | replace: ".html", ".gmi" }}">on gemini</a>
{% else %}
&#8203
{% endif %}
</small>
</p>
</nav>
@@ -1,14 +0,0 @@
{%- include fetch-backlinks.liquid -%}
{%- if referees.size > 0 %}
***
## Links to this note:
{%- for referee in referees -%}
{%- if referee != '' %}
{% assign document = site.documents | where: "slug", referee | where: "gemini", true | first %}
=> {{ document.url }} {{ document.title }} ({{ document.language }})
{{ document.excerpt }}
{%- endif -%}
{%- endfor -%}
{%- endif -%}
@@ -1,20 +0,0 @@
{%- include fetch-backlinks.liquid -%}
{% if referees.size > 0 %}
<aside class="backlinks">
<header>
<h2>Links to this note:</h2>
</header>
{% for referee in referees %}
{% if referee != '' %}
{% assign document = site.documents | where: "slug", referee | where: "gemini", false | first %}
<article>
<header>
<h3><a href="{{ document.url }}">{{ document.title }}</a> ({{ document.language }})</h3>
</header>
<p>{{ document.excerpt | strip_html }}</p>
</article>
{% endif %}
{% endfor %}
</aside>
{% endif %}
@@ -1,20 +0,0 @@
{% include nav.gmi.liquid %}
***
# {{ page.title }}
{%- if page.description %}
{{ page.description }}
{%- endif %}
{%- if page.date %}
Date: {{ page.date | date_to_string }}
{%- endif %}
{%- if page.tags.size > 0 %}
Tags: {% for tag in page.tags %}#{{ tag }} {% endfor %}
{%- endif %}
{{ content }}
***
{% include footer.gmi.liquid %}
@@ -1,6 +0,0 @@
---
layout: default.gmi
---
{{ content }}
{%- include note-backlinks.gmi.liquid -%}
@@ -1,6 +0,0 @@
---
layout: default.html
---
{{ content }}
{% include note-backlinks.html.liquid %}
@@ -1,4 +0,0 @@
---
layout: default.gmi
---
{{ content }}
@@ -3,12 +3,13 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
{% if page.noindex == true %} <meta name="robots" content="noindex"> {% endif %}
<title>Gabriel Fontes | {{ page.title }}</title>
<meta name="description" content="{% if page.description %}{{ page.description }}{% else %}{{ site.description }}{% endif %}" />
<link rel="canonical" href="https://{{ site.domain }}{{ page.url }}" />
{% if page.noindex == true %} <meta name="robots" content="noindex"> {% endif %}
<link rel="stylesheet" href="/assets/style.css" />
<link rel="stylesheet" id="scheme-css" />
<link rel="stylesheet" href="{{ site.themes_url }}/{{ site.default_theme }}.css" id="theme-css" />
<link rel="alternate" type="application/rss+xml" title="RSS" href="/feed.xml" />
<link rel="icon" href="data:,">
<script src="/assets/main.js"></script>
+6 -2
View File
@@ -1,3 +1,7 @@
---
layout: null
---
function setCookie(name,value,days) {
var expires = "";
if (days) {
@@ -25,13 +29,13 @@ function eraseCookie(name) {
setCookie(name, "", -1);
}
let chosen_scheme_css = document.getElementById("scheme-css");
let chosen_scheme_css = document.getElementById("theme-css");
// Set a given scheme
function setTheme(scheme) {
chosen_scheme_css.setAttribute(
"href",
"/assets/themes/" + scheme + ".css"
"{{ site.themes_url }}/" + scheme + ".css"
);
setCookie("fontes_theme", scheme);
}
-1
View File
@@ -1,5 +1,4 @@
---
---
@import "themes/{{ site.default_theme }}.css";
@import "main";
-17
View File
@@ -1,17 +0,0 @@
---
title: Latest Posts
description: Ocasional thoughts and guides
permalink: /blog/index.gmi
---
{%- assign posts = site.posts | where: "gemini", true | where: "draft", false -%}
{%- for post in posts -%}
{%- assign first_letter = post.excerpt | slice: 0 -%}
=> {{ post.url }} {{ post.title }} ({{ post.language }})
{{ post.date | date_to_long_string: "ordinal" }}
{%- if first_letter != "-" %}
{{ post.excerpt }}
{%- endif %}
{% endfor -%}
+1 -3
View File
@@ -2,13 +2,11 @@
title: Latest Posts
description: Ocasional thoughts and guides
permalink: /blog/index.html
has_gemini: true
---
{% assign posts = site.posts | where: "gemini", false | where: "draft", false %}
<p><a href="/feed.xml" class="feed">Feed</a></p>
{% for post in posts %}
{% for post in site.posts %}
<article>
<header>
<h2><a href="{{ post.url }}">{{ post.title }}</a> ({{ post.language }})</h2>
+2 -1
View File
@@ -6,7 +6,8 @@ permalink: /colorscheme/
<fieldset>
{% include scheme-datalist.html %}
<datalist id="scheme-list">
</datalist>
<legend>
<small>
Powered by <a href="https://github.com/base16-project/base16">base16</a>
+1 -2
View File
@@ -10,8 +10,7 @@ layout: none
<link>https://{{ site.domain }}</link>
<atom:link href="https://{{ site.domain }}{{ page.url }}" rel="self" type="application/rss+xml" />
<lastBuildDate>{% for post in site.posts limit:1 %}{{ post.date | date_to_rfc822 }}{% endfor %}</lastBuildDate>
{% assign html_posts = site.posts | where: "gemini", false %}
{% for post in html_posts limit:10 %}
{% for post in site.posts limit:10 %}
<item>
<title>{{ post.title | xml_escape }}</title>
{% if post.author.name %}
+27
View File
@@ -0,0 +1,27 @@
{ stdenv, ruby, bundlerEnv }:
let gems = bundlerEnv {
name = "website-env";
inherit ruby;
gemfile = ./Gemfile;
lockfile = ./Gemfile.lock;
gemset = ./gemset.nix;
};
in
stdenv.mkDerivation {
name = "website";
src = ./.;
JEKYLL_ENV = "production";
buildInputs = [ gems ruby ];
buildPhase = ''
${gems}/bin/bundle exec jekyll build
'';
installPhase = ''
mkdir -p $out
cp -r _site -T $out/public
'';
}
-51
View File
@@ -1,40 +1,5 @@
{
"nodes": {
"base16-schemes": {
"flake": false,
"locked": {
"lastModified": 1654895891,
"narHash": "sha256-xYYmZkHnyLCUBAkqkZ7v1Lc5m39857MukQLMRtGuvdk=",
"owner": "base16-project",
"repo": "base16-schemes",
"rev": "7c247f734eac7f04518c6e28d098635ee8dcabf5",
"type": "github"
},
"original": {
"owner": "base16-project",
"repo": "base16-schemes",
"type": "github"
}
},
"nix-colors": {
"inputs": {
"base16-schemes": "base16-schemes",
"nixpkgs-lib": "nixpkgs-lib"
},
"locked": {
"lastModified": 1658761805,
"narHash": "sha256-yPY54xna3ufsrpgk1clhsvI5Q3nNE4WAPUzIr+uEHjQ=",
"owner": "misterio77",
"repo": "nix-colors",
"rev": "17d4c968ae3b202a71326b59ae89727d1c21f018",
"type": "github"
},
"original": {
"owner": "misterio77",
"repo": "nix-colors",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1660842467,
@@ -51,24 +16,8 @@
"type": "github"
}
},
"nixpkgs-lib": {
"locked": {
"lastModified": 1655599917,
"narHash": "sha256-kjZbt5WdTrnjMxL79okg9TCoRUdADG50x/TWozbyTsE=",
"owner": "nix-community",
"repo": "nixpkgs.lib",
"rev": "5fb55578aa2f1a502d636a8ac71aece57cb730bb",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixpkgs.lib",
"type": "github"
}
},
"root": {
"inputs": {
"nix-colors": "nix-colors",
"nixpkgs": "nixpkgs"
}
}
+3 -19
View File
@@ -1,12 +1,11 @@
{
description = "My personal website, blog, and digital garden";
description = "My personal website and blog";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-22.05";
nix-colors.url = "github:misterio77/nix-colors";
};
outputs = { self, nixpkgs, nix-colors }:
outputs = { self, nixpkgs }:
let
supportedSystems = [ "x86_64-linux" "aarch64-linux" ];
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
@@ -14,23 +13,8 @@
in
rec {
packages = forAllSystems (system: rec {
main = pkgsFor.${system}.callPackage ./nix/main.nix { inherit themes; };
main = pkgsFor.${system}.callPackage ./. { };
default = main;
themes = pkgsFor.${system}.callPackage ./nix/themes.nix { inherit nix-colors; };
serve = pkgsFor.${system}.callPackage ./nix/serve.nix { inherit main; };
shell = pkgsFor.${system}.callPackage ./nix/shell.nix { inherit themes main; };
});
apps = forAllSystems (system: {
default = {
type = "app";
program = "${packages.${system}.serve}/bin/serve";
};
});
devShells = forAllSystems (system: {
default = packages.${system}.shell;
});
hydraJobs = {
-63
View File
@@ -1,63 +0,0 @@
{ stdenv, ruby, bundlerEnv, themes, python3Packages, dos2unix, perl }:
let
gems = bundlerEnv {
name = "website-env";
inherit ruby;
gemfile = ../Gemfile;
lockfile = ../Gemfile.lock;
gemset = ./gemset.nix;
};
in
stdenv.mkDerivation {
name = "website";
src = ../.;
JEKYLL_ENV = "production";
buildInputs = [ gems ruby python3Packages.md2gemini dos2unix perl ];
buildPhase = ''
# Add themes
mkdir _src/assets/themes -p
ln -s ${themes}/list.html -T _src/_includes/scheme-datalist.html
ln -s ${themes}/*.css -t _src/assets/themes/
# Convert markdown to gemtext, if needed
shopt -s globstar
for mdfile in _src/**/*.md; do
gmifile="''${mdfile/%.md/.gmi}"
# Skip creating if gmi version already exists or if md does not have front matter
if [ -f "$gmifile" ] || ! grep "\-\-\-" "$mdfile"; then
continue
fi
echo "Converting $mdfile"
# Grab front matter
sed -n '/---/,/---/p' "$mdfile" > "$gmifile"
# Turn markdown linebreaks into actual breaks, as well as link lists, so md2gemini respects it
sed -E 's/(^\[.*\]\(.*\))(\s*\\+|\s\s+)$/\1\n/gm' "$mdfile" | \
sed -E 's/^-\s+(\[.*\]\(.*\))$/\1\n/gm' | \
md2gemini --frontmatter --links copy --plain --md-links >> "$gmifile"
# Fix CRLF
dos2unix "$gmifile"
# Rewrite frontmatter containing .html permalinks into .gmi ones
sed -Ei 's/(^permalink:.*)\.html/\1\.gmi/g' "$gmifile"
# Rewrite relative .html links into .gmi
sed -Ei 's/(^=>\s+\..*)\.html/\1\.gmi/g' "$gmifile"
# Trim double newlines between links
perl -0777 -pe 's/(^=>.*$)\n\n=>/\1\n=>/mg' -i "$gmifile"
perl -0777 -pe 's/(^=>.*$)\n\n=>/\1\n=>/mg' -i "$gmifile"
done
${gems}/bin/bundle exec jekyll build
'';
installPhase = ''
mkdir -p $out
cp -Tr _site $out/public
'';
}
-13
View File
@@ -1,13 +0,0 @@
{ writeShellApplication, main, webfs, agate, http-port ? 4000, gmi-port ? 1965 }: writeShellApplication {
name = "serve";
runtimeInputs = [ webfs agate ];
text = ''
echo "Serving on: http://localhost:${toString http-port} and gemini://localhost:${toString gmi-port}"
webfsd -f index.html -d -F -p ${toString http-port} -r ${main}/public & \
agate --content ${main}/public --hostname localhost --certs /tmp/agate-certs --addr "0.0.0.0:${toString gmi-port}" & \
jobs=$(jobs -p)
trap 'kill $jobs' EXIT
wait
'';
}
-17
View File
@@ -1,17 +0,0 @@
{ mkShell, yq, openring, main, themes }: mkShell {
inputsFrom = [ main ];
buildInputs = [ yq openring ];
shellHook = ''
while [ ! -f flake.nix ]; do
echo "Looking for flake.nix, going one directory up"
cd ..
done
rm _src/_includes/scheme-datalist.html 2> /dev/null
rm _src/assets/themes/* 2> /dev/null
mkdir _src/assets/themes -p
ln -s ${themes}/list.html -T _src/_includes/scheme-datalist.html
ln -s ${themes}/*.css -t _src/assets/themes/
'';
}
-58
View File
@@ -1,58 +0,0 @@
{ nix-colors, stdenv, jq }:
let
inherit (builtins) toJSON toFile;
in
stdenv.mkDerivation {
name = "website-themes";
src = toFile "schemes" (toJSON nix-colors.colorSchemes);
dontUnpack = true;
buildInputs = [ jq ];
buildPhase = /* bash */ ''
build_css() {
scheme_name="$1"
scheme=$(jq -r --arg scheme_name "$scheme_name" '.[$scheme_name]' $src)
jq -r '"
/* \(.name) by \(.author) */
:root {
--scheme-name: \"\(.name)\";
--scheme-author: \"\(.author)\";
--base00: #\(.colors.base00);
--base01: #\(.colors.base01);
--base02: #\(.colors.base02);
--base03: #\(.colors.base03);
--base04: #\(.colors.base04);
--base05: #\(.colors.base05);
--base06: #\(.colors.base06);
--base07: #\(.colors.base07);
--base08: #\(.colors.base08);
--base09: #\(.colors.base09);
--base0A: #\(.colors.base0A);
--base0B: #\(.colors.base0B);
--base0C: #\(.colors.base0C);
--base0D: #\(.colors.base0D);
--base0E: #\(.colors.base0E);
--base0F: #\(.colors.base0F);
}
"' <<< "$scheme" > "$scheme_name.css"
}
echo '<datalist id="scheme-list">' > list.html
for scheme_name in $(jq -r 'keys[]' $src); do
echo " <option>$scheme_name</option>" >> list.html
build_css "$scheme_name" &
done
echo "</datalist>" >> list.html
wait
'';
installPhase = ''
mkdir $out
cp * $out
'';
}