fix CI
continuous-integration/drone/push Build is failing Details

This commit is contained in:
Cadey Ratio 2020-05-06 07:55:37 -04:00
parent 6db6d5edba
commit 0738a7b7cd
7 changed files with 64 additions and 33 deletions

View File

@ -4,31 +4,23 @@ workspace:
base: /lewa
steps:
- name: build ebook files
image: xena/pandoc
pull: always
- name: build book docker image
image: "monacoremo/nix:2020-04-05-05f09348-circleci"
commands:
- cd book/src && ./build.sh
- cd book && nix-build
- cp $(readlink result) /lewa/result/docker.tgz
volumes:
- name: book
path: /lewa/book/book
- name: build mdbook
image: xena/mdbook
pull: always
commands:
- cd book && mdbook build
volumes:
- name: book
path: /lewa/book/book
- name: build image
path: /lewa/result
- name: push image
image: docker:dind
volumes:
- name: book
path: /lewa/book/book
path: /lewa/result
- name: dockersock
path: /var/run/docker.sock
commands:
- cd book && sh -c 'docker build -t xena/lewa:$DRONE_COMMIT .'
- docker import -f /lewa/result/docker.tgz
volumes:
- name: book

40
book/default.nix Normal file
View File

@ -0,0 +1,40 @@
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 {
name = "xena/lewa-book";
contents = [ book nur.repos.xe.quickserv ];
config.Cmd = [ "/bin/quickserv" "-port=9001" "-dir=/book" ];
}

1
book/result Symbolic link
View File

@ -0,0 +1 @@
/nix/store/gy2ifmas4zw9i1l9i2m2411fqhbrmyf6-docker-image-lewa-book.tar.gz

View File

@ -1,18 +1,14 @@
#!/bin/sh
set -e
FILES='
intro/index.md
intro/diary_language.md
intro/CHANGELOG.md
intro/diary_language.md
intro/CHANGELOG.md
'
set -x
pandoc -o lewa.epub --epub-chapter-level=2 --resource-path=. title.md $FILES
pandoc -o test.tex -s --include-in-header sectionpagebreak.tex --variable=subparagraph --toc --toc-depth=2 --resource-path=. title.md $FILES
pandoc -o lewa.pdf --include-in-header sectionpagebreak.tex --variable=subparagraph --toc --toc-depth=2 --pdf-engine xelatex --resource-path=. title.md $FILES || exit
kindlegen lewa.epub
mkdir -p ../book
cp -vrf lewa.mobi ../book/
cp -vrf lewa.epub ../book/
cp -vrf lewa.pdf ../book/
pandoc -o ../book/lewa.epub --epub-chapter-level=2 --resource-path=. title.md $FILES
pandoc -o ../book/lewa.pdf --include-in-header sectionpagebreak.tex --variable=subparagraph --toc --toc-depth=2 --pdf-engine xelatex --resource-path=. title.md $FILES

View File

@ -12,15 +12,15 @@
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"nixpkgs": {
"branch": "nixos-19.09",
"branch": "nixpkgs-unstable",
"description": "A read-only mirror of NixOS/nixpkgs tracking the released channels. Send issues and PRs to",
"homepage": "https://github.com/NixOS/nixpkgs",
"owner": "NixOS",
"repo": "nixpkgs-channels",
"rev": "a7ceb2536ab11973c59750c4c48994e3064a75fa",
"sha256": "0hka65f31njqpq7i07l22z5rs7lkdfcl4pbqlmlsvnysb74ynyg1",
"rev": "e23f530858308b9248cfaffb4b99966c0545d4f2",
"sha256": "02hjg0zgy0wc6bczsqnqhs4d0gh1idhgdgv114nfkfwlfyx2a2r1",
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs-channels/archive/a7ceb2536ab11973c59750c4c48994e3064a75fa.tar.gz",
"url": "https://github.com/NixOS/nixpkgs-channels/archive/e23f530858308b9248cfaffb4b99966c0545d4f2.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
}
}

2
nix/texlive.nix Normal file
View File

@ -0,0 +1,2 @@
{ texlive }:
texlive.combine { inherit (texlive) scheme-medium noto titlesec; }

View File

@ -1,12 +1,12 @@
let
pkgs = import <nixpkgs> { };
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;
};
dyson = pkgs.callPackage ./nix/dyson.nix { };
tex = with pkgs;
texlive.combine { inherit (texlive) scheme-medium noto titlesec; };
tex = pkgs.callPackage ./nix/texlive.nix { };
in pkgs.mkShell {
buildInputs = with pkgs; [
dyson