← Back to context

Comment by eloisant

5 days ago

Is there any static site generator where you specify the version you use, and the launcher will simply run the old binary that you want?

Like most build systems work, for example when you set a "rust-version" in Cargo.toml and only bump it when you explicitely want to. This way it will still use the older version on a fresh checkout.

Just wrap it in a Nix flake and define a devshell. The entire config won’t exceed more than ~10 lines of Nix.

Once setup, all you need to do is:

    $ nix develop —-command hugo regenerate
    $ # version is pinned by flake.lock

The beauty of this approach is that it extends to almost any CLI tool you can think of :)

  • This is the way. This is how I do it with mine but use channels instead of flakes because I'm a giant curmudgeon.

    My devshell can be found here and is dead simple: https://github.com/stusmall/stuartsmall.com/blob/main/defaul...

    I used Zola for my SSG and can't think of the last breaking change I've hit. I just use the pattern of locked nix devshells for everything by default. The extra tools are used for processing images or cooklang files.

> Is there any static site generator where you specify the version you use, and the launcher will simply run the old binary that you want?

For Hugo, there is Hugo Version Manager (hvm)[0], a project maintained by Hugo contributor Joe Mooring. While the way it works isn't precisely what you described, it may come close enough.

[0]: https://github.com/jmooring/hvm

  • I hate to say it, but even the existence of this tool is a danger sign.

    I say this as someone who uses Hugo and is regularly burned (singed) by breaking changes.

    Pinning your version is great until you trip across a bug (usually rendering, in my case) and need to upgrade to get rid of it. There goes a few hours. I won’t even mention the horror of needing a test suite to make sure the rendering of your old pages hasn’t changed significantly. (I ended up with large portions of text in a code block, never tracked the root cause down… probably something to do with too much indentation inside a bulleted list. It didn’t render that way several years before, though.)

I use `mise` to manage all my tool versions[0] and committing the version file to the repo is sufficient for later use. https://mise.jdx.dev/

0: not all, I use cargo to manage the rust toolchain