fediversity.eu/lib.nix

19 lines
464 B
Nix
Raw Normal View History

2024-10-11 12:28:57 +02:00
{ pkgs, lib, ... }:
{
files = dir: lib.mapAttrs'
(
name: value:
let
html = "${lib.removeSuffix ".nix" name}.html";
md = "${lib.removeSuffix ".nix" name}.md";
in
{
name = html;
value = pkgs.runCommand html { buildInputs = with pkgs; [ cmark ]; } ''
2024-10-11 12:31:13 +02:00
cmark ${builtins.toFile md (import (dir + "/${name}")).body} > $out
2024-10-11 12:28:57 +02:00
'';
}
)
(builtins.readDir dir);
}