From 68f25d69d6ff7b85fd3aba40c8617e8e63e614f5 Mon Sep 17 00:00:00 2001 From: Fernando Ayats Date: Mon, 10 Jul 2023 12:24:41 +0200 Subject: [PATCH] build doc with nix --- .github/workflows/release.yaml | 7 +++---- doc/.envrc | 2 +- doc/default.nix | 36 +++++++++++++++++++++++++++++++--- 3 files changed, 37 insertions(+), 8 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index d172c2c..8fb9ffe 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -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 @@ -70,7 +69,7 @@ jobs: omitName: true allowUpdates: true replacesArtifacts: true - artifacts: "doc/out/index.pdf" + artifacts: "*.pdf" tag: runs-on: ubuntu-latest diff --git a/doc/.envrc b/doc/.envrc index 9a3aa85..da00031 100644 --- a/doc/.envrc +++ b/doc/.envrc @@ -2,4 +2,4 @@ watch_file default.nix watch_file ../flake.nix watch_file ../flake.lock -use flake .#doc +use flake .#doc-dev diff --git a/doc/default.nix b/doc/default.nix index cdbcb3c..450e2f8 100644 --- a/doc/default.nix +++ b/doc/default.nix @@ -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 @@ -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; + }); }