I’ve recently had a bit of a mishap with my macOS installation which has provided me with the opportunity to try out Asahi Linux. Not wanting to take too many chances at once, I chose to go with the Fedora Asahi Remix distribution.
While the experience has been quite positive overall, it has left me without my beloved Nix package manager. Since I tend to use a variety of programming languages, this has me relearning how each development environment works.
I had started to take for granted, just how useful local Nix flakes are. Now, instead of just entering the directory and waiting for a moment while direnv loads the Nix flake, I find myself keeping up various versions of Rust, Haskell, Go, Typst, and Zig globally on my machine.
Especially for rapidly changing languages like Zig, flakes pinning a specific version on a project-by-project basis is extremely useful!
This Blog
This blog is built with Hakyll, see also this
for specifics. This means that the static site generator is defined in a
site.hs file which is then compiled via your favorite
Haskell toolchain into a site binary.
site build then converts my Markdown files into HTML and
arranges everything the way that I want it, ready to compress and upload
it to sourcehut pages via
hut.
Since you typically don’t need to make changes to the static site
generator, all you really need is the site and
hut executables in your path which is exactly what the
flake exposes by default when you type nix shell.
Now, it’s been a few years since I did anything with Haskell, so I’m
out of practice; which means, I had to figure out from scratch how to
install the toolchain, why it wasn’t finding zlib even
though it was installed (apparently, I was missing the development
dependencies zlib-devel), and then install the
site binary globally, as well as
sudo dnf install hut.
You might wonder, is it really that painful to do these things?
Especially, since the main pain comes only once upon first setup.
Instead of installing site globally, could I not use direnv
to manipulate the path so that it finds the local build? Or just run
cabal run site build? Could this not be alleviated by
having a setup script, that does most of this stuff for you, just like
the flake.nix? And probably you’re right. But it is less
convenient now that I’m used to Nix.
Typst
As for Typst it is available via Snap, but for some reason I
couldn’t get it to work. So, since I had a Rust toolchain for a
different project anyway, I installed it via
cargo install --locked typst-cli. This worked fine, once I
had separately installed the openssl-devel
dependencies.
In between the version I had pinned and the current one, it doesn’t seem like there were breaking changes. However, in rapidly developing languages, that is always a possibility; depending on the language, there may be ways of pinning specific versions, but that is not always the case. And either way, it is more convenient to have the same way of handling pinning across different projects.
Conclusion
Anyway, this is just me rambling because I hadn’t realized how much I have come to rely on Nix and the conveniences it provides for granted. Maybe I should try to put NixOS on this machine instead, but for now this seems like a good exercise.
I do dearly miss Nix, though.