{
    description = "Annotated Annals: A blog";

    inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-22.05";
    inputs.flake-utils.url = "github:numtide/flake-utils";
    inputs.hermit-zola = { url = "github:VersBinarii/hermit_zola"; flake = false; };

    outputs = { self, nixpkgs, flake-utils, hermit-zola }:
    flake-utils.lib.eachDefaultSystem (system:
    let
        pkgs = nixpkgs.legacyPackages.${system};
        themeName = "hermit_zola";
    in
    {
        packages.blog = pkgs.stdenv.mkDerivation rec {
            pname = "annotated-annals";
            version = "2022-08-28";
            src = ./.;
            nativeBuildInputs = [ pkgs.zola ];
            configurePhase = ''
                  mkdir -p "themes/${themeName}"
                  cp -r ${hermit-zola}/* "themes/${themeName}"
            '';
            buildPhase = "zola build";
            installPhase = "cp -r public $out";
        };

        defaultPackage = self.packages.${system}.blog;

        devShell = pkgs.mkShell {
            packages = [ pkgs.zola ];
            shellHook = ''
                ln -fsn "${hermit-zola}" "themes/${themeName}"
            '';
        };
    });
}