I built this on Nix. And it was very easy.

First though, Credit where it’s due, I borrowed from This with some updates.

At the moment, the configuration for this site looks like this:


let
  nixpkgs = builtins.fetchTarball {
    # Descriptive name to make the store path easier to identify
    name = "nixpkgs-march-13-2024";
    url = https://github.com/NixOS/nixpkgs/archive/ddcd7598b2184008c97e6c9c6a21c5f37590b8d2.tar.gz;
    # Hash obtained using `nix-prefetch-url --unpack <url>`
    sha256 = "1gvricg9hinsc399d76im9vn3wjn34wcmfzfflwyz9yhr5npcr4b";
  };
in
{ pkgs ? import nixpkgs { } }:

with pkgs;

let

  hugo-theme-papermod = runCommand "hugo-theme-papermod"
    {
      pinned = builtins.fetchTarball {
        name = "Hugo-Theme-PaperMod";
        url = https://github.com/adityatelange/hugo-PaperMod/archive/f5c737f.tar.gz;
        sha256 = "0m9vllmp5j33j2ga3cy7zqa5z2wcvh4jph4g6fhch0smqla1sp73";
      };

      patches = [ ];

      preferLocalBuild = true;
    }
    ''
      cp -r $pinned $out
      chmod -R u+w $out

      for p in $patches; do
        echo "Applying patch $p"
        patch -d $out -p1 < "$p"
      done
    '';

in

mkShell {
  buildInputs = [
    hugo
  ];

  shellHook = ''
    mkdir -p themes
    ln -snf "${hugo-theme-papermod}" themes/PaperMod
  '';
}

Which frankly, is excellent! (Also of note, I’ve set it up so that the text above will always be the current version that’s in use!)

With this, I have in one fell swoop:

  • Locked in exactly the version of Hugo in Use
  • Locked in exactly the theme version to Use
  • And ensured my site should always be able to build!

Hidden Goodies of Note:

There is a Search available, which should just work. Have fun!