{
  description = "tlater.net web server contents";

  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-22.05";
    npmlock2nix = {
      url = "github:nix-community/npmlock2nix";
      flake = false;
    };
  };

  outputs = {
    self,
    nixpkgs,
    flake-utils,
    npmlock2nix,
  }: let
    # At the moment, we only deploy to x86_64-linux. Update when we
    # care about another platform.
    system = "x86_64-linux";
    overlays = [
      (final: prev: {
        npmlock2nix = import npmlock2nix {pkgs = prev;};
      })
    ];
    pkgs = import nixpkgs {inherit system overlays;};
  in {
    packages.${system} = rec {
      tlaternet-templates = pkgs.npmlock2nix.build {
        src = self;

        installPhase = ''
          cp -r dist $out/
        '';

        postFixup = ''
          ${pkgs.rename}/bin/rename 's/.html$/.html.hbs/' $out/browser/*.html
        '';

        node_modules_attrs = {
          buildInputs = with pkgs; [
            pkg-config
            python3
            vips
            glib
          ];
        };
      };

      default = tlaternet-templates;
    };

    devShells.${system} = {
      default = pkgs.npmlock2nix.shell {
        src = self;
        node_modules_attrs = {
          buildInputs = with pkgs; [
            pkg-config
            python3
            vips
            glib
          ];
        };
      };
    };
  };
}
