How this website is built - Nix and ox-hugo by ~glorifiedgluer

A few months ago I announced that I’m now using ox-hugo but didn’t go through the whole setup. Now the time has come to show you how everything works here. It basically works around three main tools (that I assume you already know about):

I use GNU Emacs to edit a single Org file placed at content-org/ that contains all the contents of this website. There’s also a file called .dir-locals.el that I use to activate the function org-hugo-auto-export-mode when I open an Org file inside the website’s directory.

  . ((org-mode . ((eval . (org-hugo-auto-export-mode)))))))

org-hugo-auto-export-mode is responsible to automatically export the article I’m editing to the content directory as a Markdown file on each save I do, allowing me to use Hugo’s auto-reload feature.

This was the trickiest part of the whole process. I ended up creating a file called export.el with the function I found here to export all my files at once on CI. If you don’t use Nix, all you need is a GNU Emacs with ox-hugo installed and then run this:

emacs $(pwd) --batch -load export.el

Now, if you’re a Nix person, you can easily create a derivation to build everything with a custom GNU Emacs.

  customEmacs = (emacsPackagesFor emacs-nox).emacsWithPackages
    (epkgs: with epkgs.melpaPackages; [
    ++ (with epkgs.elpaPackages; [
stdenv.mkDerivation {
  name = "glorifiedgluercom";
  src = lib.cleanSource ./.;

  buildInputs = [

  configurePhase = ''
    emacs $(pwd) --batch -load export.el

  buildPhase = ''

  installPhase = ''
    mkdir -p $out
    cp -r public/* $out