niXhtml is a pure, reproducible Nix library for generating static documents using Nix and nothing but Nix; no Bash, no hacks and not even a dependency on nixpkgs.lib. The HTML documents (including in-line styles) can be created using ONLY Nix. The helper functions also allow using a stylesheet path if you wish to do yourself a favor and use a stylesheet written in CSS and not Nix. Though, the point remains that niXhtml is created using ONLY Nix builtins and allows for PURE nix websites. No takesies backsies.

Basic Elements & Text

Standard HTML tags like paragraphs (p) and headings (h1-h6) are generated from Nix attribute keys.

Inline elements like strong text and emphasized text can be nested using _fragment .

Lists

Unordered (ul) and ordered (ol) lists are generated from Nix lists:

  • List Item 1
  • List Item 2 with a code snippet.
  • List Item 3
    • This is a nested list item
    • Raw HTML inside a nested list!

Attributes & Styling

HTML attributes are added using keys prefixed with '@'. Styling is primarily handled via CSS classes linked externally.

This div uses the .card class for styling defined in style.css .

Special Keys

  • _text : For simple string content, e.g., this span .
  • _raw : Injects raw HTML without escaping: This is raw & unescaped .
  • _comment : Adds an HTML comment: (view source).
  • _fragment : Allows mixing text nodes and sibling elements within a parent.
niXhtml Feature Showcase