auto commit on build

hosts/crayon/git.nix
overlays/ttpre.nix
This commit is contained in:
Squibid 2025-11-14 11:28:39 -05:00
parent cb143193ee
commit 43e6ff1487
Signed by: squibid
GPG key ID: BECE5684D3C4005D
2 changed files with 42 additions and 1 deletions

View file

@ -1,4 +1,4 @@
{ config, ... }: { config, pkgs, ... }:
let let
cfg = config.services.forgejo; cfg = config.services.forgejo;
srv = cfg.settings.server; srv = cfg.settings.server;
@ -12,6 +12,10 @@ in {
locations."/".proxyPass = "http://localhost:${toString srv.HTTP_PORT}"; locations."/".proxyPass = "http://localhost:${toString srv.HTTP_PORT}";
}; };
users.users.${cfg.user}.packages = with pkgs; [
mandoc
ttpre
];
services.forgejo = { services.forgejo = {
enable = true; enable = true;
database.type = "postgres"; database.type = "postgres";
@ -31,6 +35,14 @@ in {
DEFAULT_PUSH_CREATE_PRIVATE = false; DEFAULT_PUSH_CREATE_PRIVATE = false;
ENABLE_PUSH_CREATE_USER = true; ENABLE_PUSH_CREATE_USER = true;
}; };
"markup.mandoc" = {
ENABLED = true;
FILE_EXTENSIONS = ".1,.2,.3,.4,.5,.6,.7,.8,.9";
RENDER_COMMAND = pkgs.writeShellScriptBin "mandoc-ttpre" ''
${pkgs.mandoc}/bin/mandoc -O fragment -Tutf8 -Kutf-8 "$1" | ${pkgs.ttpre}/bin/ttpre
'' + "/bin/mandoc-ttpre";
IS_INPUT_FILE = true;
};
}; };
}; };
} }

29
overlays/ttpre.nix Normal file
View file

@ -0,0 +1,29 @@
{ unstable }:
final: prev: {
ttpre = prev.stdenv.mkDerivation {
pname = "ttpre";
version = "1.0";
src = prev.fetchurl {
url = "https://git.causal.agency/src/plain/bin/ttpre.c?id=7d87749a623ef4f1274903f91ebaf90dcd1cc9b5";
name = "ttpre.c";
sha256 = "sha256-K0S12UBBvEdNHOF+O63gw0PCtYkxxWesxnpRg9iSDmk=";
};
nativeBuildInputs = [ prev.gcc ];
unpackPhase = ":"; # we don't need to unpack it's just a c file
buildPhase = "gcc -o ttpre $src";
installPhase = ''
mkdir -p $out/bin
mv ttpre $out/bin
'';
meta = {
description = "Wrap a file in <pre> tags";
license = "AGPLv3";
homepage = "https://git.causal.agency/src/";
mainProgram = "ttpre";
maintainers = [ "squibid" ];
};
};
}