-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathhoh.nix
55 lines (51 loc) · 1.58 KB
/
hoh.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
{ pkgs
, target ? "html"
}:
let
pythonInputs = with pkgs.python311Packages; [
sphinx
sphinxcontrib-bibtex
sphinxcontrib-tikz
sphinx-autobuild
pip
# marked as broken in nixpkgs unfortunately
# sphinx-book-theme
## until we have a reason for tex leave this commented out for CI
];
nonPythonInputs = with pkgs; [ sphinx-press-theme # this comes from the overlay
sphinx-copybutton # this comes from the overlay
# pandoc
# change once extension fixes are upstreamed
sphinx-exec-directive
rst2html5
ghc
cabal-install
git
tex-env
];
in
pkgs.stdenv.mkDerivation {
pname = "hoh";
version = "0.0.1";
src = ./.;
phases = [ "unpackPhase" "preBuild" "buildPhase" "installPhase"];
buildInputs = pythonInputs ++ nonPythonInputs;
preBuild = ''
unset SOURCE_DATE_EPOCH
export CABAL_DIR=$(mktemp -d)
cabal user-config update
'';
buildPhase = ''
runHook preBuild
export PATH="${pkgs.lib.makeBinPath (pythonInputs ++ nonPythonInputs)}:$PATH";
SOURCE_DATE_EPOCH="$(${pkgs.coreutils}/bin/date '+%s')"
make clean
make ${target} SPHINXOPTS="-W"
touch "_build/.nojekyll"
touch "_build/html/.nojekyll"
'';
installPhase = ''
mkdir -p $out/
cp -r _build/${target}/ $out/
'';
}