This repository has been archived on 2024-11-13. You can view files and clone it, but cannot push or open issues or pull requests.
fediversity.eu/lib.nix

19 lines
462 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);
}