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

@@ -64,6 +64,10 @@
url = "github:zhaofengli/colmena";
inputs.nixpkgs.follows = "nixpkgs";
};
syntax-renderer = {
url = "sourcehut:~repomaa/syntax-renderer";
flake = false;
};
};
outputs = { flake-parts, agenix, nixpkgs, self, colmena, ... }@inputs:
flake-parts.lib.mkFlake { inherit inputs; } (

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 = {

View File

@@ -37,18 +37,6 @@ in
auth_tokens_file = secrets.hastebin-tokens.path;
};
users.users.hastebin = {
isSystemUser = true;
group = "hastebin";
};
users.groups.hastebin = { };
systemd.services.hastebin.serviceConfig = {
DynamicUser = lib.mkForce false;
User = "hastebin";
};
services.webserver = {
enable = lib.mkDefault true;
vHosts.${fqdn} = {