build static sites and host them on caddy
Find a file
2024-12-04 23:37:19 +00:00
lib Add mkSiteName instead of doing the string interpolation everywhere 2024-12-04 23:37:19 +00:00
modules Comment out Caddy plugin (for now) 2024-12-03 19:17:12 +00:00
tests Add mkSiteName instead of doing the string interpolation everywhere 2024-12-04 23:37:19 +00:00
.gitignore Remove internal.mkSiteBuilder 2024-11-29 00:03:53 +00:00
flake.lock Alpha version of static site builder 2024-11-26 19:41:59 +00:00
flake.nix Use shortHash command most of the time 2024-11-30 14:07:31 +00:00
README.md Update README.md 2024-11-27 09:48:13 +00:00

NixOS Static Site Builder

This flake grabs and builds static sites (maybe via a default.nix) and copies their outputs to /var/www

You can import it into your flake.nix like:

inputs = {
  site-builder = {
    url = "git+https://git.chobble.com/chobble/nixos-site-builder";
    inputs.nixpkgs.follows = "nixpkgs";
  };
};

and then add it as a module to your server's host, like:

({ config, ... }: {
  imports = [ site-builder.nixosModules.default ];
  services.site-builder = {
    enable = true;
    sites = {
      "chobble.com" = {
        gitRepo = "http://localhost:3000/chobble/chobble";
        wwwRedirect = true;
      };
      "veganprestwich.co.uk" = {
        gitRepo = "http://localhost:3000/chobble/vegan-prestwich";
        wwwRedirect = true;
      };
    };
  };
})

My Git repos in this example are hosted on localhost by my Forgejo instance but yours can be wherever.