Define flake for nix-run in a Latex project

Hi here,

I am converting my texlive project which create a PDF book into a Nix Flake project. The coversion progresses so good so far and I can run nix build to generate PDF book file successfully.

For next step, I want to use Zathura, a pdf viewer, to open this generated PDF book file when run nix run.

By looking into Nix Flake material, I unstand that there has to be a apps.<system>... definition. However I am not sure how the definition will be for my case as my PDF file is not executable.

It would be appreciate if someone can help with this, and provide a sameple code.


I would write a script derivation that takes the pdf and zathura as inputs, and simply opens the file.

Thanks! A sample code snippet would be appreciated.

Something like:

  outputs = {nixpkgs, self, ...}: {
    apps."${system}".default = toString (nixpkgs.legacyPackages."${system}".writeShellApplication {
      name = "show-pdf";
      runtimeInputs = [ zathura ];
      text = ''
        zathura ${self.packages."${system}".default}/out.pdf

Making some broad assumptions and not defining the system here, left as an exercise for the reader.