Howto: install epub reader thorium

tldr: here a derivation to install epub reader thorium.

All, I was looking for an epub reader with script capabilities to read my go books (the game not the language). None of the readers were displaying the diagrams nicely except, foliate and atril. However foliate does not have scripts, so no interactivity. Atril does, but cpu usage goes through the roof (on every distro I tried).

I finally found thorium, that does work for my use case. I ran the binary in an FHS.
Today I wrote a appimageTools.wrapType2 derivation (cf nixos manual) that downloads it, and installs it in an FHS. Posting here in case someone wants to use thorium too.
My derivation.nix is basic/ugly/not using version etc and all the goodies, but does the job.

Run it with ./result/bin/thorium-1.6.0 <bookname.epub>
because selecting a book via the menu, the application crashes.

Howto:
create the following files default.nix and derivation.nix.
In the dir containing them, run nix-build
thorium can be executed via ./result/bin/thorium-1.6.0 <bookname.epub>

default.nix:

{ pkgs ? import <nixpkgs> {} }:

pkgs.callPackage ./derivation.nix {}

derivation.nix:

{ pkgs, fetchurl, glibc, glib, udev, libudev, nss, nspr, atk, at, libX11, libxcb, dbus, gdk-pixbuf, gtk3-x11, pango, cairo, libXcomposite, libXdamage, libXext, libXfixes, libXrandr, expat, libdrm, libxkbcommon, mesa, alsaLib, cups, at-spi2-core, at-spi2-atk }:

pkgs.appimageTools.wrapType2 { # or wrapType1
  name = "thorium-1.6.0";
  src = fetchurl {
    url = "https://github.com/edrlab/thorium-reader/releases/download/v1.6.0/Thorium-1.6.0.AppImage";
    sha256 =  "ce2888673573ac6ba1e9d7b8540724ec83c95f9696c4bcd50fe65b6f459f31e3";
  };
extraPkgs = pkgs: with pkgs; [ glibc glib libudev nss nspr atk at dbus gdk-pixbuf gtk3-x11 pango cairo expat libdrm libxkbcommon mesa alsaLib cups at-spi2-core at-spi2-atk libX11 libxcb libXcomposite libXdamage libXext libXfixes libXrandr udev ];
}