It’s pretty easy to host a Hugo website on NixOS, but it did take me a few tries to figure out how to build the package properly. Here’s the quick and easy way: create a package like so:

{ stdenv, hugo }:
stdenv.mkDerivation {
  name = "blog-korfuri-fr-website";
  src = ./blog;
  nativeBuildInputs = [ hugo ];
  phases = [ "unpackPhase" "buildPhase" ];
  buildPhase = ''
    hugo -s . -d "$out"
  '';
}

You can then use this in your packages easily, e.g. with nginx:

services.nginx.virtualHosts."blog.korfuri.fr" = {
  forceSSL = true;
  enableACME = true;
  root = callPackage ./blog-korfuri-fr-website.nix {};
};

And that’s it. This is how this blog is served.