-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
69 lines (65 loc) · 1.99 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
{
inputs = {
nixpkgs.url = github:nixos/nixpkgs/nixos-24.05;
flake-utils.url = github:numtide/flake-utils;
typix = {
url = github:loqusion/typix;
inputs.nixpkgs.follows = "nixpkgs";
};
typst-packages = {
url = github:typst/packages;
flake = false;
};
};
outputs = { self, nixpkgs, flake-utils, typix, typst-packages, ... }: flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
inherit (pkgs) lib;
tx = typix.lib.${system};
typstPackagesSrc = "${typst-packages}/packages";
typstPackagesCache = pkgs.stdenv.mkDerivation {
name = "typst-packages-cache";
src = typstPackagesSrc;
dontBuild = true;
installPhase = ''
mkdir -p "$out/typst/packages"
cp -LR --reflink=auto --no-preserve=mode -t "$out/typst/packages" "$src"/*
'';
};
typstProject = {
typstSource = "main.typ";
fontPaths = [
"./template/resources/"
];
};
typstProjectWatch = {
typstSource = "./bericht/main.typ";
fontPaths = typstProject.fontPaths;
};
typstProjectSrc = {
src = ./bericht;
XDG_CACHE_HOME = typstPackagesCache;
};
in {
devShell = pkgs.mkShell {
buildInputs = with pkgs; [
typst
python312
python312Packages.pandas
python312Packages.glob2
python312Packages.matplotlib
python312Packages.jupyter-core
python312Packages.ipykernel
python312Packages.numpy
python312Packages.xarray
python312Packages.scipy
python312Packages.statistics
];
};
packages.IP-report = tx.buildTypstProject (typstProject // typstProjectSrc);
packages.default = self.packages.${system}.IP-report;
apps.watch = flake-utils.lib.mkApp { drv = tx.watchTypstProject typstProjectWatch; };
apps.default = self.apps.${system}.watch;
}
);
}