Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ericsagnes committed Jul 3, 2017
0 parents commit 0e70f4b
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
result*
11 changes: 11 additions & 0 deletions example/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{ pkgs ? import <nixpkgs> {} }:

with pkgs.lib;

(pkgs.callPackage ../mkPresentation.nix) {
src = ./.;
name = "example-presentation";
# reveal version can be changed with revealJS
# 3.5.0 is used by default
revealVersion = "3.4.0";
}
12 changes: 12 additions & 0 deletions example/presentation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
author: John Doe
title: Demo Slide
date: June 21, 2017
---
# Foo
```python
print("hello world")
```
# Bar
* test
* test
34 changes: 34 additions & 0 deletions mkPresentation.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Nix expression to generate a slidy presentation

{ # the nixpkgs set to use
pkgs
, src
, name
, revealVersion ? "3.5.0"
# extra dependencies
,extraBuildInputs ? []
# assets to include in the result packages, typically examples
,assets ? []
}:
let
revealJS = fetchTarball "https://github.com/hakimel/reveal.js/archive/${revealVersion}.tar.gz";
in

pkgs.stdenv.mkDerivation rec {
inherit name src;

preferLocalBuild = true;
allowSubstitutes = false;

# dependencies declaration
buildInputs = with pkgs; [ pandoc ] ++ extraBuildInputs;

installPhase = ''
mkdir $out
for presentation in $(find . -name "*\.md"); do
id=$(basename $presentation ".md")
pandoc -t revealjs -s -o $out/"$id".html "$id".md
done
ln -s ${revealJS} $out/reveal.js
'';
}
9 changes: 9 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Reveal.js slides Nix builder

example slides are in example/presentation.md.

Can be built by running:

```sh
$ nix-build example
```

0 comments on commit 0e70f4b

Please sign in to comment.