Compare commits

...
Sign in to create a new pull request.

14 commits

Author SHA1 Message Date
71de0c15a7 blog update 2026-04-09 18:01:40 +02:00
770a20de04 automatic git version control in scripts 2026-04-05 23:26:40 +02:00
6a5baa5416 README update 2026-04-05 23:13:06 +02:00
08ab6070d4 better run.sh 2026-04-05 23:11:43 +02:00
1efb3f5e69 using binary in project root instead 2026-04-05 22:48:57 +02:00
f398e4336d nix package, better errors 2026-04-05 22:17:09 +02:00
36c3967170 fixed rss order 2026-04-05 21:19:40 +02:00
0beaa152b4 wow 2026-04-01 20:23:13 +02:00
abbb7b7e2e the culprit 2026-03-29 18:07:12 +02:00
af8b7ba279 readme 2026-03-28 21:52:12 +01:00
a237f584dc yeay 2026-03-28 21:38:22 +01:00
fde9e32fe0 nice 2026-03-28 21:27:33 +01:00
94d12da846 donzo 2026-03-28 21:09:52 +01:00
225d0f4b25 wow 2026-03-28 21:00:43 +01:00
13 changed files with 93 additions and 127 deletions

1
.gitignore vendored
View file

@ -4,3 +4,4 @@ index.html
blog-tmp.html
public/index.html
public/rss.xml
mdf-blog

7
README.md Normal file
View file

@ -0,0 +1,7 @@
- If using a precompiled version of mdf-blog, place the `mdf-blog` executable
in this directory (project root).
- Use `./new.sh` to create new blogpost in ./blogs. This will open your
editor defined by the EDITOR environment variable.
- Use `./run.sh` to generate all output files in "./public"
- Use `USERNAME="your username" PASSWORD="your password" ./push.sh` to
push to server.

View file

@ -3,6 +3,7 @@ author: Rakarake
pubDate: Fri, Mar 27 2026
---
Warframe.
Erm, yeah.
![a spinning golden banana](./golden-banana.gif "Oh Banana")

View file

@ -1,5 +1,6 @@
title: A statement
title: Infrastructure complete
author: Rakarake
pubDate: Fri, Mar 27 2026
pubDate: Sat, Mar 28 2026
---
Kyuuuuuuu! 🐳
It's been done 🐍🥰💕.

5
blogs/day8.md Normal file
View file

@ -0,0 +1,5 @@
title: We love slop
author: Rakarake
pubDate: Sat, Mar 28 2026
---
🐖🐖

9
blogs/day9.md Normal file
View file

@ -0,0 +1,9 @@
title: NEW MDF MEMBER IN AGES
author: Rakarake
pubDate: Wed, Apr 1 2026
---
Welcome Loriik!
Huge moment for the MDF, the interview process was long and tedious.
Hundreds of candidates. Many work hours. (real).

71
flake.lock generated
View file

@ -1,21 +1,5 @@
{
"nodes": {
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1696426674,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-utils": {
"inputs": {
"systems": "systems"
@ -66,28 +50,11 @@
"type": "github"
}
},
"nixpkgs_3": {
"locked": {
"lastModified": 1771043024,
"narHash": "sha256-O1XDr7EWbRp+kHrNNgLWgIrB0/US5wvw9K6RERWAj6I=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "3aadb7ca9eac2891d52a9dec199d9580a6e2bf44",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-25.11",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs",
"rust-overlay": "rust-overlay",
"zig-overlay": "zig-overlay"
"rust-overlay": "rust-overlay"
}
},
"rust-overlay": {
@ -122,42 +89,6 @@
"repo": "default",
"type": "github"
}
},
"systems_2": {
"flake": false,
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"zig-overlay": {
"inputs": {
"flake-compat": "flake-compat",
"nixpkgs": "nixpkgs_3",
"systems": "systems_2"
},
"locked": {
"lastModified": 1772540502,
"narHash": "sha256-HXlx2i9gGH2HKfBSMihKCvU6DQMVlR4iyOulkSOe+Cg=",
"owner": "mitchellh",
"repo": "zig-overlay",
"rev": "03fa375def0685b8ce282f118452532845f16a20",
"type": "github"
},
"original": {
"owner": "mitchellh",
"repo": "zig-overlay",
"type": "github"
}
}
},
"root": "root",

View file

@ -1,14 +1,13 @@
{
description = "Rust flake";
description = "mdf-blog";
inputs =
{
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; # or whatever vers
flake-utils.url = "github:numtide/flake-utils";
rust-overlay.url = "github:oxalica/rust-overlay";
zig-overlay.url = "github:mitchellh/zig-overlay";
};
outputs = { self, nixpkgs, flake-utils, rust-overlay, zig-overlay, ... }:
outputs = { nixpkgs, flake-utils, rust-overlay, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
overlays = [ (import rust-overlay) ];
@ -17,33 +16,20 @@
};
in
{
devShell = pkgs.mkShell rec {
LD_LIBRARY_PATH = "${pkgs.lib.makeLibraryPath buildInputs}";
defaultPackage = pkgs.rustPlatform.buildRustPackage {
name = "mdf-blog";
pname = "mdf-blog";
src = ./.;
cargoLock = {
lockFile = ./Cargo.lock;
};
};
devShell = pkgs.mkShell {
packages = with pkgs; [
rustc
cargo
rust-analyzer
gcc
zig-overlay.packages."x86_64-linux".master
];
buildInputs = with pkgs; [
libdisplay-info
libgbm
#mesa
libinput
pixman
seatd
udev
libxkbcommon
wayland
wayland.dev
wayland-protocols
libGL
vulkan-headers vulkan-loader
vulkan-tools vulkan-tools-lunarg
vulkan-extension-layer
vulkan-validation-layers # don't need them *strictly* but immensely helpful
#libglvnd
curl
];
};
}

8
new.sh Executable file
View file

@ -0,0 +1,8 @@
#!/bin/sh
git pull
printf "name of file (e.g. day67.md): "
read filename
cargo run -- new > blogs/$filename
$EDITOR blogs/$filename

12
push.sh Executable file
View file

@ -0,0 +1,12 @@
#!/bin/sh
git add blogs
git commit -m "blog update"
git push
for file in $(find public -type f)
do
echo "uploading: $file"
curl -u "$USER:$PASSWORD" https://mdf.farm/api/${file#*/} --upload-file $file
done

8
run.sh
View file

@ -1,8 +1,12 @@
#/bin/sh
cargo run -- html blogs/* > blog-tmp.html
cargo build && cp target/debug/mdf-blog . || true
BLOGS=$(ls $PWD/blogs/*)
./mdf-blog html $BLOGS > blog-tmp.html
sed template.html -e '/INSERT_HERE/{
r blog-tmp.html
d
}' > public/index.html
cargo run -- rss blogs/* > public/rss.xml
./mdf-blog rss $BLOGS > public/rss.xml

View file

@ -1,10 +1,11 @@
use std::{collections::HashMap, io, path::Path};
use markdown::to_html;
use rss::{Channel, GuidBuilder, ItemBuilder};
use rss::{Channel, ChannelBuilder, GuidBuilder, Item, ItemBuilder};
fn main() -> io::Result<()> {
fn main() -> Result<(), String> {
let posts = std::env::args().skip(2).map(|f| {
let contents = std::fs::read_to_string(f.clone())?;
let contents = std::fs::read_to_string(f.clone()).map_err(|e| format!("when reading file {f} got {e}"))?;
// parse metadata, then the rest to html
let mut metadata: HashMap<String, String> = contents.lines().take_while(|l| {
// header ends here
@ -26,17 +27,17 @@ fn main() -> io::Result<()> {
}).concat();
Ok((to_html(&body), metadata))
}).collect::<Result<Vec<(String, HashMap<String, String>)>, io::Error>>()?;
}).collect::<Result<Vec<(String, HashMap<String, String>)>, String>>()?;
if let Some(mode) = std::env::args().skip(1).next() {
match mode.as_str() {
"rss" => {
let mut channel = Channel::default();
channel.title = "MDF blog huge".to_string();
channel.link = "https://mdf.farm".to_string();
channel.description = "The MDF blog".to_string();
channel.generator = Some("Rakabaka's tooling".to_string());
channel.items = posts.iter().map(|(body, metadata)| {
let channel = ChannelBuilder::default()
.title("MDF blog huge".to_string())
.link("https://mdf.farm".to_string())
.description("The MDF blog".to_string())
.generator(Some("Rakabaka's tooling".to_string()))
.items(posts.iter().map(|(body, metadata)| {
let guid = metadata.get("guid").map(|guid|
GuidBuilder::default()
.value(guid)
@ -50,11 +51,12 @@ fn main() -> io::Result<()> {
.link(metadata.get("guid").map(|g| format!("https://mdf.farm/#{g}")))
.guid(guid)
.build()
}).collect();
}).collect::<Vec<Item>>())
.build();
print!("{}", channel);
},
"html" => {
print!("{}", posts.iter().enumerate().map(|(i, (body, metadata))| {
print!("{}", posts.iter().rev().enumerate().map(|(i, (body, metadata))| {
let guid = metadata.get("guid").unwrap_or(&i.to_string()).clone();
let title = metadata.get("title").map(|title| format!("<h1>{title}</h1>")).unwrap_or("".to_string());
let pub_date = metadata.get("pubDate").map(|pub_date| format!("<i>{pub_date}</i>")).unwrap_or("".to_string());

View file

@ -1 +0,0 @@
rsync -rvz -e 'ssh -p 8022' --progress public/* rakarake@chat.mdf.farm:/data/website