Open source

NixOS Shield

Generate nftables rules from a service contract for a self-hosted Mastodon or Matrix server.

Video tutorial

Quick start

  1. Download the archive for your system and extract it. Open a terminal in the extracted folder.

  2. On Linux, generate the sample Matrix ruleset and read it.

    ./nixos-shield examples/matrix.json > matrix.nft
    cat matrix.nft
  3. On Windows, preview the same rules in PowerShell.

    .\nixos-shield.exe examples/matrix.json
  4. On an isolated Linux machine with nftables installed, check syntax without applying the rules. Review access requirements before deployment.

    sudo nft --check --file matrix.nft
Terminal output with the nftables rules generated for Matrix