Skip to content

Commit

Permalink
Improve building the PDF via Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
WhatisRT committed Aug 2, 2023
1 parent e49fe43 commit 4073cf2
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 13 deletions.
8 changes: 8 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,14 @@ To install Agda locally and use that install with emacs, you can do the followin

`nix-shell` provides Agda complete with the correct dependencies. So you should be able to run your preferred editor within `nix-shell` and it should see the required `agda` executable.

## Building the PDF quickly

The Makefile can be used to build the PDF without having to build everything else. Either run `make` from within `nix-shell`, or use
```
nix-shell --command make
```
to run `make` without launching an interactive shell.

## Updating nixpkgs

To update the default nixpkgs used to build the derivations, run
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
tex_files := Introduction.tex BaseTypes.tex TokenAlgebra.tex Crypto.tex Address.tex Script.tex GovernanceActions.tex PParams.tex Transaction.tex Utxo.tex Utxow.tex Tally.tex Deleg.tex Ledger.tex Ratify.tex Chain.tex Utxo/Properties.tex PDF.tex
tex_files := Introduction.tex BaseTypes.tex TokenAlgebra.tex Crypto.tex Address.tex Script.tex GovernanceActions.tex PParams.tex Transaction.tex Utxo.tex Utxow.tex Gov.tex Deleg.tex Ledger.tex Ratify.tex Chain.tex Utxo/Properties.tex PDF.tex

tex_files2 := $(addprefix src/latex/Ledger/, $(tex_files))

.PHONY: all clean
src/latex/Ledger/%.tex: src/Ledger/%.lagda
cd src && agda --only-scope-checking --latex ../$<
all: $(tex_files2)
cd src/latex && xelatex Ledger/PDF.tex
cp src/latex/PDF.pdf .
cd src/latex && latexmk -xelatex Ledger/PDF.tex
cp src/latex/PDF.pdf cardano-ledger.pdf
clean:
rm -rf src/latex
rm -rf src/MAlonzo
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ nix-build -A midnight.docs # build the Midnight example docs
The `executableSpec` is a `cabal` package, which can be loaded into GHCI like this:

```
nix-shell --command "cabal repl --build-depends 'agda-ledger-executable-spec, agda-ledger-executable-spec-midnight'"
nix-shell -A run --command "cabal repl --build-depends 'agda-ledger-executable-spec, agda-ledger-executable-spec-midnight'"
λ> :m HSLedgerTest
λ> main
```
Expand Down
26 changes: 17 additions & 9 deletions shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,21 @@ with pkgs;

let specs = callPackage ./default.nix {};

in mkShell {
nativeBuildInputs = [
specs.agda
cabal-install
(haskellPackages.ghcWithPackages (pkgs: with pkgs; [
specs.ledger.executableSpec
specs.midnight.executableSpec
]))
];
in {
shell = mkShell {
nativeBuildInputs = [
specs.agdaWithStdLibMeta
];
};

run.shell = mkShell {
nativeBuildInputs = [
specs.agda
cabal-install
(haskellPackages.ghcWithPackages (pkgs: with pkgs; [
specs.ledger.executableSpec
specs.midnight.executableSpec
]))
];
};
}

0 comments on commit 4073cf2

Please sign in to comment.