summaryrefslogtreecommitdiff
path: root/mod/tools/typst/default.nix
blob: 1871cc6f7b23da754c2322989d4c1978715d97fe (plain)
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
{ pkgs, ... }:
let
  version = "0.0.0";

  depotPackages = pkgs.stdenvNoCC.mkDerivation {
    pname = "depot-typst-packages";
    inherit version;
    src = ./packages;
    phases = [ "installPhase" ];

    installPhase = ''
      for pkg in $src/*; do
        name=$(basename $pkg)
        mkdir -p $out/share/typst/packages/depot/$name/${version}
        cp -rv $pkg/* $out/share/typst/packages/depot/$name/${version}/
      done
    '';
  };
in
{
  inherit depotPackages;

  writeEnv = pkgs.mkShellNoCC {
    packages = [
      pkgs.typst
      pkgs.typstyle
      pkgs.tinymist
      depotPackages
    ];

    shellHook = "export TYPST_PACKAGE_PATH=${depotPackages}/share/typst";
    # shellHook = "alias typst='XDG_DATA_HOME=${depotPackages}/share typst'";
  };
}