-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
68 lines (57 loc) · 1.62 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
{
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-22.11";
inputs.katex.url = "https://github.com/KaTeX/KaTeX/releases/download/v0.15.1/katex.tar.gz";
inputs.katex.flake = false;
outputs = { nixpkgs, katex, ... } @ inputs:
let
forSystems = systems: f: nixpkgs.lib.genAttrs systems (system: f rec {
inherit system;
pkgs = nixpkgs.legacyPackages.${system};
lib = nixpkgs.legacyPackages.${system}.lib;
});
forAllSystems = forSystems [
"x86_64-linux"
"aarch64-linux"
];
mkInputs = pkgs: with pkgs; [
gnumake
pandoc
haskellPackages.pandoc-crossref
(texlive.combine {
inherit (texlive)
scheme-small
atkinson
fontaxes
;})
];
in {
inherit inputs;
packages = forAllSystems ({ pkgs, ... }: rec {
default = pdf;
pdf = pkgs.runCommand "cookbook-pdf" {
nativeBuildInputs = mkInputs pkgs;
} ''
cp -a ${./.}/* .
make cookbook_rust.pdf
mkdir $out
cp -a cookbook_rust.pdf $out
'';
html = pkgs.runCommand "cookbook-html" {
nativeBuildInputs = mkInputs pkgs;
} ''
cp -a ${./.}/* .
substituteInPlace Makefile --replace \
" --katex --standalone --self-contained" \
" --katex=${inputs.katex}/ --standalone --self-contained"
make cookbook_rust.html
mkdir $out
cp -a cookbook_rust.html $out/index.html
'';
});
devShells = forAllSystems ({ pkgs, ... }: {
default = pkgs.mkShellNoCC {
packages = [ pkgs.entr ] ++ mkInputs pkgs;
};
});
};
}