2024-09-12 12:55:33 +01:00
|
|
|
{
|
|
|
|
system,
|
|
|
|
nixpkgs,
|
|
|
|
}:
|
|
|
|
let
|
|
|
|
# Extend nixpkg's lib, so that we can handle recursive leaf types such as `either`
|
|
|
|
libOverlay = final: prev: {
|
|
|
|
types = prev.types // {
|
|
|
|
either =
|
|
|
|
t1: t2:
|
|
|
|
prev.types.either t1 t2
|
|
|
|
// {
|
|
|
|
getSubOptions = prefix: t1.getSubOptions prefix // t2.getSubOptions prefix;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
# Extended nixpkgs instance, with patches to nixos-render-docs
|
|
|
|
overlay = final: prev: {
|
|
|
|
lib = prev.lib.extend libOverlay;
|
|
|
|
|
|
|
|
nixos-render-docs = prev.nixos-render-docs.overrideAttrs (old: {
|
2024-09-11 00:08:51 +02:00
|
|
|
propagatedBuildInputs = old.propagatedBuildInputs ++ [
|
|
|
|
(final.python3.pkgs.callPackage ./gfm-alerts-to-admonitions {
|
|
|
|
# Use the same override as `nixos-render-docs` does, to avoid "duplicate dependency" errors
|
|
|
|
markdown-it-py = final.python3.pkgs.markdown-it-py.overridePythonAttrs { doCheck = false; };
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2024-09-12 12:55:33 +01:00
|
|
|
patches = old.patches or [ ] ++ [
|
|
|
|
# Adds support for GFM-style admonitions in rendered commonmark
|
2024-09-11 00:08:51 +02:00
|
|
|
./0001-nixos-render-docs-Output-GFM-admonition.patch
|
|
|
|
# Adds support for parsing GFM-style admonitions
|
|
|
|
./0002-nixos-render-docs-Support-gfm-style-admonitions.patch
|
2024-09-12 12:55:33 +01:00
|
|
|
];
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
in
|
|
|
|
import nixpkgs {
|
2025-01-24 20:49:25 +00:00
|
|
|
inherit system;
|
2024-09-12 12:55:33 +01:00
|
|
|
overlays = [ overlay ];
|
|
|
|
}
|