Skip to content

Commit

Permalink
build doc with nix
Browse files Browse the repository at this point in the history
  • Loading branch information
viperML committed Jul 10, 2023
1 parent 862a879 commit 68f25d6
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 8 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,8 @@ jobs:
uses: DeterminateSystems/magic-nix-cache-action@main
- name: Build doc
run: |
pushd doc
nix develop .#doc --command just build
popd
nix build .#doc -L
cp -vL ./result/*.pdf .
- uses: ncipollo/release-action@v1
name: Release
Expand All @@ -70,7 +69,7 @@ jobs:
omitName: true
allowUpdates: true
replacesArtifacts: true
artifacts: "doc/out/index.pdf"
artifacts: "*.pdf"

tag:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion doc/.envrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ watch_file default.nix
watch_file ../flake.nix
watch_file ../flake.lock

use flake .#doc
use flake .#doc-dev
36 changes: 33 additions & 3 deletions doc/default.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
{pkgs, ...}: {
devShells.doc = pkgs.mkShellNoCC {
packages = [
{
pkgs,
config,
...
}: {
packages.doc = pkgs.stdenvNoCC.mkDerivation {
name = "miq-doc";
nativeBuildInputs = [
pkgs.just
(pkgs.python3.withPackages (p: [
p.pygments
Expand Down Expand Up @@ -29,6 +34,31 @@
setspace
;
})
pkgs.which
];

src = ./.;

buildPhase = ''
runHook preBuild
just clean build
runHook postBuild
'';

installPhase = ''
runHook preInstall
mkdir -p $out
cp -vL out/index.pdf $out
runHook postInstall
'';

TEXMFHOME = "./cache";
TEXMFVAR = "./cache/var";
};

packages.doc-dev = config.packages.doc.overrideAttrs (_: {
src = null;
});
}

0 comments on commit 68f25d6

Please sign in to comment.