add syntax renderer to hastebin

This commit is contained in:
Joakim Repomaa
2025-03-01 13:14:58 +02:00
parent 6a1244821e
commit 83594e09a9
3 changed files with 28 additions and 13 deletions

View File

@@ -1,4 +1,4 @@
{ pkgs, config, ... }:
{ pkgs, config, inputs, ... }:
let
immichDataDir = "/mnt/storage/immich";
syncthingDataDir = "/mnt/storage/syncthing";
@@ -45,6 +45,29 @@ in
hastebin = {
enable = true;
subdomain = "bin";
renderers = with pkgs;
let
hl = rustPlatform.buildRustPackage {
name = "syntax-renderer";
src = inputs.syntax-renderer;
cargoHash = "sha256-+3rsXsZohapIZAQfDYCqcatj+qWmC2iD8raeECKtgzE=";
};
in
{
hl = "${hl}/bin/syntax-renderer";
sha = writeShellScript "sha-renderer" ''
echo "Content-Type: text/plain"
echo "---"
${coreutils}/bin/sha256sum - | cut -d' ' -f1
'';
stl = writeShellScript "stl-renderer" ''
echo "Content-Type: model/stl"
echo "Content-Disposition: attachment; filename=$(basename "$1" .scad).stl"
echo "---"
${openscad}/bin/openscad --export-format stl -o - -
'';
};
cleanup.enable = true;
};
readeck = {