Loading doc/languages-frameworks/typst.section.md +10 −0 Original line number Diff line number Diff line Loading @@ -15,6 +15,16 @@ typst.withPackages ( ) ``` For more customisation options, you can invoke the wrapper directly: ```nix typst.wrapper { packages = p: [ ]; fonts = [ ]; extraWrapperArgs = [ ]; } ``` ### Handling Outdated Package Hashes {#typst-handling-outdated-package-hashes} Since **Typst Universe** does not provide a way to fetch a package with a specific hash, the package hashes in `nixpkgs` can sometimes be outdated. To resolve this issue, you can manually override the package source using the following approach: Loading pkgs/by-name/ty/typst/package.nix +2 −1 Original line number Diff line number Diff line Loading @@ -71,7 +71,8 @@ rustPlatform.buildRustPackage (finalAttrs: { passthru = { updateScript = nix-update-script { }; packages = callPackage ./typst-packages.nix { }; withPackages = callPackage ./with-packages.nix { }; wrapper = callPackage ./wrapper.nix { }; withPackages = ps: finalAttrs.passthru.wrapper { packages = ps; }; }; meta = { Loading pkgs/by-name/ty/typst/with-packages.nix→pkgs/by-name/ty/typst/wrapper.nix +14 −3 Original line number Diff line number Diff line Loading @@ -8,12 +8,18 @@ lib.makeOverridable ( { ... }@typstPkgs: f: { packages ? (ps: [ ]), fonts ? [ ], extraWrapperArgs ? [ ], }: buildEnv { inherit (typst) meta; name = "${typst.name}-env"; paths = lib.foldl' (acc: p: acc ++ lib.singleton p ++ p.propagatedBuildInputs) [ ] (f typstPkgs); paths = lib.foldl' (acc: p: acc ++ lib.singleton p ++ p.propagatedBuildInputs) [ ] ( packages typstPkgs ); pathsToLink = [ "/lib/typst-packages" ]; Loading @@ -28,7 +34,12 @@ lib.makeOverridable ( cp -r ${typst}/share $out/share mkdir -p $out/bin makeWrapper "${lib.getExe typst}" "$out/bin/typst" --set TYPST_PACKAGE_CACHE_PATH $TYPST_LIB_DIR TYPST_FONT_PATHS=${lib.escapeShellArg (lib.concatStringsSep ":" fonts)} makeWrapper "${lib.getExe typst}" "$out/bin/typst" \ --set TYPST_PACKAGE_CACHE_PATH $TYPST_LIB_DIR \ ''${TYPST_FONT_PATHS:+--set TYPST_FONT_PATHS "$TYPST_FONT_PATHS"} \ ${lib.escapeShellArgs extraWrapperArgs} ''; } ) typstPackages Loading
doc/languages-frameworks/typst.section.md +10 −0 Original line number Diff line number Diff line Loading @@ -15,6 +15,16 @@ typst.withPackages ( ) ``` For more customisation options, you can invoke the wrapper directly: ```nix typst.wrapper { packages = p: [ ]; fonts = [ ]; extraWrapperArgs = [ ]; } ``` ### Handling Outdated Package Hashes {#typst-handling-outdated-package-hashes} Since **Typst Universe** does not provide a way to fetch a package with a specific hash, the package hashes in `nixpkgs` can sometimes be outdated. To resolve this issue, you can manually override the package source using the following approach: Loading
pkgs/by-name/ty/typst/package.nix +2 −1 Original line number Diff line number Diff line Loading @@ -71,7 +71,8 @@ rustPlatform.buildRustPackage (finalAttrs: { passthru = { updateScript = nix-update-script { }; packages = callPackage ./typst-packages.nix { }; withPackages = callPackage ./with-packages.nix { }; wrapper = callPackage ./wrapper.nix { }; withPackages = ps: finalAttrs.passthru.wrapper { packages = ps; }; }; meta = { Loading
pkgs/by-name/ty/typst/with-packages.nix→pkgs/by-name/ty/typst/wrapper.nix +14 −3 Original line number Diff line number Diff line Loading @@ -8,12 +8,18 @@ lib.makeOverridable ( { ... }@typstPkgs: f: { packages ? (ps: [ ]), fonts ? [ ], extraWrapperArgs ? [ ], }: buildEnv { inherit (typst) meta; name = "${typst.name}-env"; paths = lib.foldl' (acc: p: acc ++ lib.singleton p ++ p.propagatedBuildInputs) [ ] (f typstPkgs); paths = lib.foldl' (acc: p: acc ++ lib.singleton p ++ p.propagatedBuildInputs) [ ] ( packages typstPkgs ); pathsToLink = [ "/lib/typst-packages" ]; Loading @@ -28,7 +34,12 @@ lib.makeOverridable ( cp -r ${typst}/share $out/share mkdir -p $out/bin makeWrapper "${lib.getExe typst}" "$out/bin/typst" --set TYPST_PACKAGE_CACHE_PATH $TYPST_LIB_DIR TYPST_FONT_PATHS=${lib.escapeShellArg (lib.concatStringsSep ":" fonts)} makeWrapper "${lib.getExe typst}" "$out/bin/typst" \ --set TYPST_PACKAGE_CACHE_PATH $TYPST_LIB_DIR \ ''${TYPST_FONT_PATHS:+--set TYPST_FONT_PATHS "$TYPST_FONT_PATHS"} \ ${lib.escapeShellArgs extraWrapperArgs} ''; } ) typstPackages