fediversity.eu/lib.nix
Valentin Gagarin 2bb88dff9b dir is a path
2024-10-11 12:31:13 +02:00

19 lines
464 B
Nix

{ 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 ]; } ''
cmark ${builtins.toFile md (import (dir + "/${name}")).body} > $out
'';
}
)
(builtins.readDir dir);
}