forked from hmemcpy/milewski-ctfp-pdf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
139 lines (120 loc) · 3.35 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
127
128
129
130
131
132
133
134
135
136
137
138
139
{
description = "Category Theory for Programmers";
inputs.nixpkgs.url = "nixpkgs/nixos-20.03";
inputs.utils.url = "github:numtide/flake-utils";
outputs = { self, nixpkgs, utils }: utils.lib.eachDefaultSystem (system: let
pkgs = nixpkgs.legacyPackages.${system};
inherit (nixpkgs) lib;
###########################################################################
# LaTeX Environment
texliveEnv = pkgs.texlive.combine {
inherit (pkgs.texlive)
bookcover
textpos
fgruler
tcolorbox
fvextra
framed
newtx
nowidow
emptypage
wrapfig
subfigure
adjustbox
collectbox
tikz-cd
imakeidx
idxlayout
titlesec
subfiles
lettrine
upquote
libertine
mweights
fontaxes
mdframed
needspace
xifthen
ifnextok
currfile
noindentafter
ifmtarg
scheme-medium
listings
minted
microtype
babel
todonotes
chngcntr
ifplatform
xstring
minifp
titlecaps
enumitem
environ
trimspaces
l3packages
zref
catchfile
import
;
};
###########################################################################
# Python Environment
# Pin the Python version and its associated package set in a single place.
python = pkgs.python38;
pythonPkgs = pkgs.python38Packages;
pygments-style-github = pythonPkgs.buildPythonPackage rec {
pname = "pygments-style-github";
version = "0.4";
doCheck = false; # Hopefully someone else has run the tests.
src = pythonPkgs.fetchPypi {
inherit pname version;
sha256 = "19zl8l5fyb8z3j8pdlm0zbgag669af66f8gn81ichm3x2hivvjhg";
};
# Anything depending on this derivation is probably also gonna want
# pygments to be available.
propagatedBuildInputs = with pythonPkgs; [ pygments ];
};
pythonEnv = python.withPackages (
pyPkgs: with pyPkgs; [
pygments
pygments-style-github
]
);
mkPackageName = edition:
"ctfp${lib.optionalString (edition != null) "-${edition}"}";
mkPackage = isShell: edition: pkgs.stdenv.mkDerivation {
name = mkPackageName edition;
src = if isShell then null else self;
makeFlags = [
"-C" "src" "OUTPUT_DIR=$(out)"
"GIT_VER=${self.rev or self.lastModifiedDate}"
];
buildFlags = lib.optional (edition != null) edition;
dontInstall = true;
FONTCONFIG_FILE = pkgs.makeFontsConf {
fontDirectories = with pkgs; [ inconsolata-lgc libertine libertinus ];
};
buildInputs = with pkgs; [
# Misc. build tooling.
gnumake
git
python3Packages.virtualenv
which
# LaTeX Environment (with all associated libraries and packages).
texliveEnv
# Python Environment (with all associated libraries and packages).
pythonEnv
];
};
editions = [ null "scala" "ocaml" ];
in {
packages = lib.listToAttrs (map (edition: {
name = mkPackageName edition;
value = mkPackage false edition;
}) editions);
defaultPackage = self.packages.${system}.ctfp;
devShell = mkPackage true null;
});
}