File tree 1 file changed +29
-3
lines changed
1 file changed +29
-3
lines changed Original file line number Diff line number Diff line change 34
34
typst = pkgs . nixpkgs-unstable . typst ;
35
35
36
36
mkTypstScript =
37
- action :
38
- documentName :
37
+ action : documentName :
39
38
pkgs . writeShellApplication {
40
39
name = "typst-${ action } -${ documentName } " ;
41
40
56
55
'' ;
57
56
} ;
58
57
58
+ mkBuildDocumentDrv =
59
+ action : documentName :
60
+ pkgs . stdenvNoCC . mkDerivation {
61
+ pname = "typst-${ action } -${ documentName } " ;
62
+ version = typst . version ;
63
+
64
+ src = pkgs . lib . cleanSource ./. ;
65
+
66
+ buildInputs = [ typst ] ;
67
+
68
+ buildPhase = ''
69
+ runHook preBuild
70
+
71
+ ${ lib . getExe ( mkTypstScript "compile" documentName ) }
72
+
73
+ runHook postBuild
74
+ '' ;
75
+
76
+ installPhase = ''
77
+ runHook preInstall
78
+
79
+ install -m640 -D ${ documentName } .* -t $out
80
+
81
+ runHook postInstall
82
+ '' ;
83
+ } ;
84
+
59
85
documentDrvs = lib . genAttrs ( lib . attrNames (
60
86
lib . filterAttrs ( k : v : ( v == "directory" ) ) ( builtins . readDir ./src )
61
- ) ) ( d : ( mkTypstScript "compile" d ) ) ;
87
+ ) ) ( d : ( mkBuildDocumentDrv "compile" d ) ) ;
62
88
63
89
scriptDrvs =
64
90
{
You can’t perform that action at this time.
0 commit comments