mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-09 19:13:26 +03:00
typst: add support to instantiate typst with a set of typst packages
This commit is contained in:
parent
d976d61d9e
commit
c47a2a8ac7
4 changed files with 42 additions and 2 deletions
|
@ -115,7 +115,7 @@ class TypstPackage:
|
|||
hash=source_hash,
|
||||
typstDeps=[
|
||||
self.package_name_full(p, v)
|
||||
for p, v in sorted(self.deps, key=lambda x: x[0])
|
||||
for p, v in sorted(self.deps, key=lambda x: (x[0], Version(x[1])))
|
||||
],
|
||||
description=self.description,
|
||||
license=self.license_tokens(),
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
xz,
|
||||
nix-update-script,
|
||||
versionCheckHook,
|
||||
callPackage,
|
||||
}:
|
||||
|
||||
rustPlatform.buildRustPackage (finalAttrs: {
|
||||
|
@ -60,7 +61,11 @@ rustPlatform.buildRustPackage (finalAttrs: {
|
|||
versionCheckProgramArg = [ "--version" ];
|
||||
doInstallCheck = true;
|
||||
|
||||
passthru.updateScript = nix-update-script { };
|
||||
passthru = {
|
||||
updateScript = nix-update-script { };
|
||||
packages = callPackage ./typst-packages.nix { };
|
||||
withPackages = callPackage ./with-packages.nix { };
|
||||
};
|
||||
|
||||
meta = {
|
||||
changelog = "https://github.com/typst/typst/releases/tag/v${finalAttrs.version}";
|
||||
|
|
33
pkgs/by-name/ty/typst/with-packages.nix
Normal file
33
pkgs/by-name/ty/typst/with-packages.nix
Normal file
|
@ -0,0 +1,33 @@
|
|||
{
|
||||
lib,
|
||||
buildEnv,
|
||||
typstPackages,
|
||||
makeBinaryWrapper,
|
||||
typst,
|
||||
}:
|
||||
|
||||
lib.makeOverridable (
|
||||
{ ... }@typstPkgs:
|
||||
f:
|
||||
buildEnv {
|
||||
name = "${typst.name}-env";
|
||||
|
||||
paths = lib.foldl' (acc: p: acc ++ lib.singleton p ++ p.propagatedBuildInputs) [ ] (f typstPkgs);
|
||||
|
||||
pathsToLink = [ "/lib/typst-packages" ];
|
||||
|
||||
nativeBuildInputs = [ makeBinaryWrapper ];
|
||||
|
||||
postBuild = ''
|
||||
export TYPST_LIB_DIR="$out/lib/typst/packages"
|
||||
mkdir -p $TYPST_LIB_DIR
|
||||
|
||||
mv $out/lib/typst-packages $TYPST_LIB_DIR/preview
|
||||
|
||||
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
|
||||
'';
|
||||
}
|
||||
) typstPackages
|
|
@ -15287,6 +15287,8 @@ with pkgs;
|
|||
|
||||
buildTypstPackage = callPackage ../build-support/build-typst-package.nix { };
|
||||
|
||||
typstPackages = typst.packages;
|
||||
|
||||
ueberzug = with python3Packages; toPythonApplication ueberzug;
|
||||
|
||||
ueberzugpp = callPackage ../by-name/ue/ueberzugpp/package.nix {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue