-
Notifications
You must be signed in to change notification settings - Fork 18
/
flake.nix
126 lines (98 loc) · 4.06 KB
/
flake.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
{
description = "Website for ledger-cli.org";
nixConfig.bash-prompt = "ledger-cli.org$ ";
inputs = {
flake-utils.url = "github:numtide/flake-utils";
# NOTA BENE: When a new release of ledger or ledger-mode is available, update
# the tag in the url below and run `nix flake update`, so that GitHub Actions
# will build the documentation from the latest ledger and ledger-mode release.
# TODO: Replace `master` with the tag of the ledger release following 3.3.2, once available.
ledger.url = "github:ledger/ledger/master";
ledger-mode = { url = "github:ledger/ledger-mode/v4.0.0"; flake = false; };
doxygen-awesome = { url = "github:jothepro/doxygen-awesome-css/v2.3.4"; flake = false; };
};
outputs = { self, nixpkgs, flake-utils, ledger, ledger-mode, doxygen-awesome }:
flake-utils.lib.eachDefaultSystem( system:
let
pkgs = import nixpkgs { inherit system; };
tex = with pkgs; texlive.combine {
inherit (texlive) collection-plaingeneric collection-fontsrecommended;
};
in
{
packages = rec {
default = website;
website = pkgs.stdenvNoCC.mkDerivation rec {
name = "ledger-website";
version = "5.0.0-${self.shortRev or "dirty"}";
src = self;
dontConfigure = true;
nativeBuildInputs = with pkgs; [ mkdocs python3.pkgs.libsass ];
installPhase = ''
runHook preInstall
mv build $out
runHook postInstall
'';
};
doc-ledger-api = pkgs.stdenvNoCC.mkDerivation rec {
name = "ledger-api";
src = ledger;
nativeBuildInputs = with pkgs; [
cmake doxygen graphviz # doxygen uses dot from graphviz to create diagrams
];
enableParallelBuilding = false;
preConfigure = "cd doc";
cmakeFlags = [
"-Wno-dev"
"-DUSE_DOXYGEN:BOOL=ON"
"-DDOXYGEN_EXTRA_CSS:STRING=${doxygen-awesome}/doxygen-awesome.css"
"-DDOXYGEN_HTML_HEADER:STRING=${self}/apidoc_header.html"
];
# Ensure the "generated on date at time" footer shows the actual date and time
# when the API documentation was generated.
preBuild = "export SOURCE_DATE_EPOCH=$(date +'%s')";
buildFlags = "doc.doxygen";
};
doc-ledger = pkgs.stdenvNoCC.mkDerivation rec {
name = "ledger";
src = ledger;
nativeBuildInputs = with pkgs; [
cmake mandoc ghostscript texinfo tex
];
enableParallelBuilding = false;
preConfigure = "cd doc";
cmakeFlags = [ "-Wno-dev" "-DBUILD_WEB_DOCS:BOOL=ON" ];
buildFlags = "doc";
postBuild = ''
# Patch web version of ledger manual to support dark mode
sed -e 's@</style>@&\n<link rel="stylesheet" type="text/css" href="https://www.gnu.org/software/gnulib/manual.css"><link rel="stylesheet" type="text/css" href="/css/doc.css">@' ledger3.html -i
'';
};
doc-ledger-mode = pkgs.stdenvNoCC.mkDerivation rec {
name = "ledger-mode";
src = ledger-mode;
nativeBuildInputs = with pkgs; [
texinfo tex
];
enableParallelBuilding = false;
dontConfigure = true;
preBuild = "cd doc";
buildPhase = ''
runHook preBuild
texi2pdf --batch ledger-mode.texi
makeinfo --force --html --no-split ledger-mode.texi
makeinfo --force --plaintext --no-split -o ledger-mode.txt ledger-mode.texi
# Patch web version of ledger mode manual to support dark mode
sed -e 's@</style>@&\n<link rel="stylesheet" type="text/css" href="https://www.gnu.org/software/gnulib/manual.css"><link rel="stylesheet" type="text/css" href="/css/doc.css">@' ledger-mode.html -i
runHook postBuild
'';
installPhase = ''
runHook preInstall
mkdir -p $out
cp ledger-mode.html ledger-mode.pdf ledger-mode.txt $out/
runHook postInstall
'';
};
};
});
}