How this website is built - Nix and ox-hugo

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/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.

(("content-org"
  . ((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
hugo

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

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

  buildInputs = [
    customEmacs
    hugo
  ];

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

  buildPhase = ''
    hugo
  '';

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

Links to this article


Articles from blogs I follow around the net

The four tenets of SOA revisited

Twenty years after. In the January 2004 issue of MSDN Magazine you can find an article by Don Box titled A Guide to Developing and Running Connected Systems with Indigo. Buried within the (now dated) discussion of the technology…

via ploeh blog March 4, 2024

Building a demo of the Bleichenbacher RSA attack in Rust

Recently while reading Real-World Cryptography, I got nerd sniped1 by the mention of Bleichenbacher's attack on RSA. This is cool, how does it work? I had to understand, and to understand something, I usually have to build it. Well, friends, that is what…

via ntietz.com blog March 4, 2024

How to unbreak Dolphin on SteamOS after the QT6 update

A recent update to Dolphin made it switch to QT6. This makes it crash with this error or something like it: dolphin-emu: symbol lookup error: dolphin-emu: undefined symbol: _Zls6QDebugRK11QDockWidget, version Qt_6 This is fix…

via Xe Iaso's blog March 3, 2024

Generated by openring