diff --git a/flake.nix b/flake.nix index c431e16..eb25316 100644 --- a/flake.nix +++ b/flake.nix @@ -42,23 +42,6 @@ ]; }; - typst-wrapper-factory = - typstDrv: typst-packages: typstFontPaths: - pkgs.writeShellApplication { - name = "typst-wrapper"; - - runtimeInputs = [ - typstDrv - typst-packages - ]; - - text = '' - TYPST_FONT_PATHS=${typstFontPaths} XDG_CACHE_HOME=${typst-packages} ${lib.getExe typstDrv} "$@" - ''; - }; - - typst-wrapper = typst-wrapper-factory typst config.packages.typst-packages fontsConf; - mkBuildDocumentDrv = documentName: pkgs.stdenvNoCC.mkDerivation { @@ -66,18 +49,18 @@ src = pkgs.lib.cleanSource ./.; - buildInputs = [ typst-wrapper ]; - buildPhase = '' runHook preBuild - ${lib.getExe typst-wrapper} \ + ${lib.getExe typst} \ compile \ --root ./. \ --input rev="${inputs.self.rev or ""}" \ --input shortRev="${inputs.self.shortRev or ""}" \ --input builddate="$(date -u -d @${toString (inputs.self.lastModified or "")})" \ + --package-path ${inputs.typst-packages}/packages \ --font-path ${fontsConf} \ + --ignore-system-fonts \ ./src/${documentName}/main.typ \ ${documentName}.pdf @@ -98,16 +81,18 @@ pkgs.writeShellApplication { name = "build-${documentName}"; - runtimeInputs = [ typst-wrapper ]; + runtimeInputs = [ typst ]; text = '' - ${lib.getExe typst-wrapper} \ + ${lib.getExe typst} \ compile \ --root ./. \ --input rev="${inputs.self.rev or ""}" \ --input shortRev="${inputs.self.shortRev or ""}" \ --input builddate="$(date -u -d @${toString (inputs.self.lastModified or "")})" \ + --package-path ${inputs.typst-packages}/packages \ --font-path ${fontsConf} \ + --ignore-system-fonts \ ./src/${documentName}/main.typ \ ${documentName}.pdf ''; @@ -118,16 +103,18 @@ pkgs.writeShellApplication { name = "watch-${documentName}"; - runtimeInputs = [ typst-wrapper ]; + runtimeInputs = [ typst ]; text = '' - ${lib.getExe typst-wrapper} \ + ${lib.getExe typst} \ watch \ --root ./. \ --input rev="${inputs.self.rev or ""}" \ --input shortRev="${inputs.self.shortRev or ""}" \ --input builddate="$(date -u -d @${toString (inputs.self.lastModified or "")})" \ + --package-path ${inputs.typst-packages}/packages \ --font-path ${fontsConf} \ + --ignore-system-fonts \ ./src/${documentName}/main.typ \ ${documentName}.pdf ''; @@ -157,7 +144,6 @@ devShells.default = pkgs.mkShellNoCC { packages = (lib.attrValues scriptDrvs) ++ [ typst - typst-wrapper pkgs.gnuplot pkgs.pympress ]; @@ -165,7 +151,6 @@ shellHook = '' echo "Typst version: ${typst.version}" echo "Typst bin: ${lib.getExe typst}" - echo "Typst wrapper bin: ${lib.getExe typst-wrapper}" echo "Typst packages directory: ${config.packages.typst-packages}" echo "Typst fonts directory: ${fontsConf}" '';