{
  inputs =
  {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
    self.lfs = true;
  };
  outputs = inputs:
    let
      pkgs = import inputs.nixpkgs { system = "x86_64-linux"; config.allowUnfree = true; };
      typst = pkgs.typst.withPackages (ps: with ps; [ minimal-presentation ]);
      env.TYPST_FONT_PATHS = builtins.concatStringsSep ":" (builtins.map (p: "${p}/share/fonts")
        (with pkgs; [ corefonts source-han-serif nerd-fonts.fira-code ]));
      buildTypst = name: source: pkgs.runCommand name { nativeBuildInputs = [ typst ]; src = ./.; inherit env; }
      ''
        mkdir -p $out
        typst compile --root $src $src/${source} $out/${name}
      '';
    in
    {
      packages.x86_64-linux =
      {
        paper = buildTypst "paper.pdf" "paper/main.typ";
        slide = buildTypst "slide.pdf" "slide/main.typ";
      };
    };
}
