This repository was archived by the owner on Nov 1, 2025. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 61
Expand file tree
/
Copy pathflake.nix
More file actions
95 lines (80 loc) · 2.74 KB
/
flake.nix
File metadata and controls
95 lines (80 loc) · 2.74 KB
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
{
description = "Bayesian Statistics flake with a shell";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.treefmt-nix.url = "github:numtide/treefmt-nix";
outputs = { self, nixpkgs, flake-utils, treefmt-nix }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
treefmtEval = treefmt-nix.lib.evalModule pkgs ./treefmt.nix;
julia = pkgs.julia-bin.overrideDerivation (oldAttrs: { doInstallCheck = false; });
typst-packages = builtins.fetchGit {
url = "https://github.com/typst/packages.git";
ref = "main";
rev = "66f5634493fe02d406b5e43d674696669fb77442"; # 2025-08-11
};
typst-fonts = pkgs.stdenvNoCC.mkDerivation {
name = "typst-fonts";
src = self;
installPhase =
let
fonts = {
inherit (pkgs) fira fira-mono julia-mono inriafonts;
};
in
pkgs.lib.concatStringsSep "\n" (map
(name: ''
mkdir -p $out/share/fonts/${name}
cp -r ${fonts.${name}}/share/fonts/* $out/share/fonts/${name}
'')
(builtins.attrNames fonts));
};
in
rec {
formatter = treefmtEval.config.build.wrapper;
checks.formatting = treefmtEval.config.build.check self;
devShells.default = pkgs.mkShell {
packages = with pkgs;[
bashInteractive
# pdfpc # FIXME: broken on darwin
typos
cmdstan
julia
# typst part
typst
typst-fonts
typst-live
typstfmt
hayagriva
];
shellHook = ''
export JULIA_NUM_THREADS="auto"
export JULIA_PROJECT="turing"
export CMDSTAN_HOME="${pkgs.cmdstan}/opt/cmdstan"
export TYPST_FONT_PATHS="${typst-fonts}/share/fonts"
'';
};
packages = {
inherit typst-fonts;
default = pkgs.stdenvNoCC.mkDerivation {
name = "slides";
src = self;
buildInputs = with pkgs; [
typst
typst-fonts
];
buildPhase = ''
mkdir -pv $out/.cache/typst
cp -rv ${typst-packages}/packages $out/.cache/typst
export XDG_CACHE_HOME="$out/.cache"
export TYPST_FONT_PATHS="${typst-fonts}/share/fonts"
typst compile ./slides/slides.typ ./slides/slides.pdf
'';
installPhase = ''
cp ./slides/slides.pdf $out/
'';
};
};
});
}