Skip to content

Commit 40303ba

Browse files
committed
Add nix flake
1 parent 67db0ef commit 40303ba

File tree

10 files changed

+190
-7
lines changed

10 files changed

+190
-7
lines changed

Curriculum/Module 00 - Mindset/slides/Module_00_Slides_Mindset.typ

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
)
77

88
#set text(font: "Noto Sans Mono", weight: "regular", size: 20pt)
9-
#show math.equation: set text(font: "TeX Gyre Math")
9+
#show math.equation: set text(font: "Fira Math")
1010
#set strong(delta: 100)
1111
#set par(justify: true)
1212

Curriculum/Module 01 - Ethics and Legal/slides/Module_01_Slides_Ethics.typ

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
)
77

88
#set text(font: "Noto Sans Mono", weight: "regular", size: 20pt)
9-
#show math.equation: set text(font: "TeX Gyre Math")
9+
#show math.equation: set text(font: "Fira Math")
1010
#set strong(delta: 100)
1111
#set par(justify: true)
1212

Curriculum/Module 01 - Ethics and Legal/slides/Module_01_Slides_Legal.typ

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
)
77

88
#set text(font: "Noto Sans Mono", weight: "regular", size: 20pt)
9-
#show math.equation: set text(font: "TeX Gyre Math")
9+
#show math.equation: set text(font: "Fira Math")
1010
#set strong(delta: 100)
1111
#set par(justify: true)
1212

Curriculum/Module 07 - Reverse Engineering/slides/Module_07_Slides_Rev.typ

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#enable-handout-mode(false)
1111

1212
#set text(font: "Noto Sans Mono", weight: "regular", size: 20pt)
13-
#show math.equation: set text(font: "TeX Gyre Math")
13+
#show math.equation: set text(font: "Fira Math")
1414
#set strong(delta: 100)
1515
#set par(justify: true)
1616

Curriculum/Module 08 - Binary Exploitation/slides/Module_08_Slides_PWN.typ

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#enable-handout-mode(false)
1111

1212
#set text(font: "Noto Sans Mono", weight: "regular", size: 20pt)
13-
#show math.equation: set text(font: "TeX Gyre Math")
13+
#show math.equation: set text(font: "Fira Math")
1414
#set strong(delta: 100)
1515
#set par(justify: true)
1616

Curriculum/Module 11 - Linux and Server Security/slides/Module_11_Slides_Privilege_Escelation.typ

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
)
77

88
#set text(font: "Noto Sans Mono", weight: "regular", size: 20pt)
9-
#show math.equation: set text(font: "TeX Gyre Math")
9+
#show math.equation: set text(font: "Fira Math")
1010
#set par(justify: true)
1111

1212
#title-slide(

athena-typst-theme

flake.lock

Lines changed: 95 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
{
2+
description = "typst environment";
3+
nixConfig.bash-prompt = "\[typst\]$ ";
4+
5+
inputs = {
6+
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
7+
utils.url = "github:numtide/flake-utils";
8+
typst-packages = {
9+
url = "github:typst/packages";
10+
flake = false;
11+
};
12+
typst-pkg-src = {
13+
url = "github:NixOS/nixpkgs/21808d22b1cda1898b71cf1a1beb524a97add2c4";
14+
inputs = {};
15+
};
16+
};
17+
18+
outputs = { self, nixpkgs, utils, typst-packages, typst-pkg-src, ... }:
19+
utils.lib.eachDefaultSystem (system:
20+
let
21+
p = import nixpkgs { inherit system; };
22+
typstFromOldCommit = import typst-pkg-src { inherit system; };
23+
24+
fonts = with p; [
25+
noto-fonts
26+
fira-math
27+
];
28+
29+
fontPaths = (builtins.map (x: x + "/share/fonts/opentype") fonts)
30+
++ (builtins.map (x: x + "/share/fonts/truetype") fonts)
31+
++ [ ./fonts ];
32+
fontParam = p.lib.concatStringsSep ":" fontPaths;
33+
34+
typstPackagesCache = p.stdenv.mkDerivation {
35+
name = "typst-packages-cache";
36+
src = "${typst-packages}/packages";
37+
dontBuild = true;
38+
installPhase = ''
39+
mkdir -p "$out/typst/packages"
40+
cp -LR --reflink=auto --no-preserve=mode -t "$out/typst/packages" "$src"/*
41+
'';
42+
};
43+
44+
derivation = { stdenvNoCC, ... }:
45+
stdenvNoCC.mkDerivation {
46+
name = "typst-build";
47+
src = ./.;
48+
buildInputs = [ typstFromOldCommit.typst ] ++ fonts;
49+
50+
buildPhase = ''
51+
echo "Current directory contents:"
52+
ls -la
53+
mkdir -p out
54+
export XDG_CACHE_HOME=${typstPackagesCache}
55+
export TYPST_FONT_PATHS=${fontParam}
56+
57+
find Curriculum -type f -path "*/slides/*.typ" | while read file; do
58+
name=$(basename "$file" .typ)
59+
echo "Compiling $file → $name.pdf"
60+
typst compile "$file" "out/$name.pdf" --root .
61+
done
62+
'';
63+
64+
installPhase = ''
65+
mkdir -p $out
66+
cp out/*.pdf $out/
67+
'';
68+
};
69+
in {
70+
devShell = p.mkShell.override { stdenv = p.stdenv; } rec {
71+
packages = [
72+
typstFromOldCommit.typst
73+
p.tinymist
74+
# p.typst-live # Remove if not in nixpkgs 25.05
75+
] ++ fonts;
76+
77+
shellHook = ''
78+
export XDG_CACHE_HOME=${typstPackagesCache}
79+
export TYPST_FONT_PATHS=${fontParam}
80+
'';
81+
82+
name = "Typst build";
83+
};
84+
85+
packages.default = p.callPackage derivation {};
86+
}
87+
);
88+
}

fonts/.gitkeep

Whitespace-only changes.

0 commit comments

Comments
 (0)