# { pkgs ? import (import nix/fetch-nixpkgs.nix) {}
# }:
{ pkgs ? import <nixpkgs> {} }:

with pkgs;

let
  latexPackage = pkgs.texlive.combine {
    inherit (texlive)

    # base packages
    scheme-small

    csquotes
    latexmk
    moderncv
    needspace
    fontawesome
    silence
    wrapfig
    enumitem
    mathpazo
    ;
  };

in

stdenv.mkDerivation {
  name = "story";
  buildInputs = [
    latexPackage

    # language correction
    pkgs.languagetool
    # detex script
    pkgs.python
    # make
    pkgs.gnumake
    # PDF viewer
    pkgs.zathura
  ];

  src = ./.;
  buildPhase = "make";

  meta = with lib; {
    description = "Deterministic LaTeX template using Nix";
    license = licenses.bsd3;
    platforms = platforms.linux;
  };
}
