42 lines
1020 B
Nix
42 lines
1020 B
Nix
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 { };
|
|
version = "devel";
|
|
book = pkgs.stdenv.mkDerivation {
|
|
pname = "lewa-book";
|
|
inherit version;
|
|
src = ./.;
|
|
phases = "buildPhase installPhase";
|
|
buildInputs = with pkgs; [
|
|
kindlegen
|
|
mdbook
|
|
nur.repos.mic92.pandoc-bin
|
|
tex
|
|
];
|
|
|
|
buildPhase = ''
|
|
cp -rf $src/src .
|
|
cp -rf $src/book.toml .
|
|
mkdir book
|
|
mdbook build
|
|
cd ./src && ./build.sh && cd ..
|
|
cd ./book && kindlegen lewa.epub ||: && cd ..
|
|
'';
|
|
|
|
installPhase = ''
|
|
mkdir -p $out
|
|
cp -rf book $out/book
|
|
'';
|
|
};
|
|
in pkgs.dockerTools.buildLayeredImage {
|
|
name = "within/lewa-book";
|
|
tag = version;
|
|
contents = [ nur.repos.xe.quickserv book ];
|
|
config.Cmd = [ "/bin/quickserv" "-port=9001" "-dir=/book" ];
|
|
}
|