Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A nix flake for the final rendered result #133

Merged
merged 7 commits into from
Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .github/workflows/merge-acceptance.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,12 @@ jobs:
- run: mdbook build
- name: Check for Orphaned Files
run: ./util/find-orphaned-files.sh

# Reference: https://github.com/marketplace/actions/install-nix
check-flake:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v22
- run: nix build
- run: nix flake check
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ git config --local core.hooksPath git-hooks

## Prerequisites

Note: Nix users can rely on `flake.nix` which packages the final rendered HTML into `<prefix>/share/doc/tfl-book`. Users can install this via `nix profile install 'github:Electric-Coin-Company/tfl-book'`, or to build the local version `nix build`.

### Rust prerequisites

- `cargo install mdbook`
Expand Down
27 changes: 27 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

39 changes: 39 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
description = "The Zcash Trailing Finality Layer Book";

inputs.nixpkgs.url = "github:nixos/nixpkgs/23.11";

outputs = { self, nixpkgs }:
let
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages."${system}";

tfl-book-pkg = pkgs.stdenv.mkDerivation rec {
pname = "tfl-book";
version = "0.1.0"; # BUG: This should be derived from the `git describe --dirty`

buildInputs = with pkgs; [
graphviz
mdbook
mdbook-graphviz
mdbook-linkcheck
daira marked this conversation as resolved.
Show resolved Hide resolved
mdbook-katex
];

src = ./.;

builder = pkgs.writeScript "${pname}-builder-${version}" ''
source "$stdenv/setup"
cp -a "$src" ./src
cd ./src
chmod -R u+w .
mdbook build
dest="$out/share/doc/${pname}/"
mkdir -p "$(dirname "$dest")"
cp -a ./build/html "$dest"
'';
};
in {
packages."${system}".default = tfl-book-pkg;
};
}