2020-05-06 11:55:37 +00:00
|
|
|
let
|
|
|
|
sources = import ../nix/sources.nix;
|
|
|
|
pkgs = import sources.nixpkgs { };
|
|
|
|
nur = import (builtins.fetchTarball
|
|
|
|
"https://github.com/nix-community/NUR/archive/master.tar.gz") {
|
|
|
|
inherit pkgs;
|
|
|
|
};
|
|
|
|
tex = pkgs.callPackage ../nix/texlive.nix { };
|
2020-05-06 13:47:54 +00:00
|
|
|
version = "devel";
|
2020-05-06 11:55:37 +00:00
|
|
|
book = pkgs.stdenv.mkDerivation {
|
|
|
|
pname = "lewa-book";
|
2020-05-06 13:47:54 +00:00
|
|
|
inherit version;
|
2020-05-06 11:55:37 +00:00
|
|
|
src = ./.;
|
|
|
|
phases = "buildPhase installPhase";
|
|
|
|
buildInputs = with pkgs; [
|
|
|
|
kindlegen
|
|
|
|
mdbook
|
|
|
|
nur.repos.mic92.pandoc-bin
|
|
|
|
tex
|
|
|
|
];
|
|
|
|
|
|
|
|
buildPhase = ''
|
2020-05-06 15:56:32 +00:00
|
|
|
cp -rf $src/src .
|
|
|
|
cp -rf $src/book.toml .
|
2020-05-06 11:55:37 +00:00
|
|
|
mkdir book
|
|
|
|
mdbook build
|
|
|
|
cd ./src && ./build.sh && cd ..
|
|
|
|
cd ./book && kindlegen lewa.epub ||: && cd ..
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out
|
2020-05-06 15:56:32 +00:00
|
|
|
cp -rf book $out/book
|
2020-05-06 11:55:37 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
in pkgs.dockerTools.buildLayeredImage {
|
2020-05-15 20:21:36 +00:00
|
|
|
name = "within/lewa-book";
|
2020-05-06 14:08:41 +00:00
|
|
|
tag = version;
|
2020-05-06 15:56:32 +00:00
|
|
|
contents = [ nur.repos.xe.quickserv book ];
|
2020-05-06 11:55:37 +00:00
|
|
|
config.Cmd = [ "/bin/quickserv" "-port=9001" "-dir=/book" ];
|
|
|
|
}
|