lewa/book/default.nix

41 lines
1021 B
Nix
Raw Normal View History

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 { };
book = pkgs.stdenv.mkDerivation {
pname = "lewa-book";
version = "devel";
src = ./.;
phases = "buildPhase installPhase";
buildInputs = with pkgs; [
kindlegen
mdbook
nur.repos.mic92.pandoc-bin
tex
];
buildPhase = ''
cp -vrf $src/src .
cp -vrf $src/book.toml .
mkdir book
mdbook build
ls -la ./book
cd ./src && ./build.sh && cd ..
cd ./book && kindlegen lewa.epub ||: && cd ..
'';
installPhase = ''
mkdir -p $out
cp -vrf book $out/book
'';
};
in pkgs.dockerTools.buildLayeredImage {
2020-05-06 13:26:05 +00:00
name = "xena/lewa-book:${book.version}";
2020-05-06 11:55:37 +00:00
contents = [ book nur.repos.xe.quickserv ];
config.Cmd = [ "/bin/quickserv" "-port=9001" "-dir=/book" ];
}