mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-10-04 05:50:00 +00:00
typstPackages: Make a dedicated Universe package builder
This commit is contained in:
@@ -2,31 +2,50 @@
|
||||
lib,
|
||||
buildTypstPackage,
|
||||
fetchzip,
|
||||
# typstPackages from within the scope
|
||||
packages,
|
||||
hash,
|
||||
description,
|
||||
license,
|
||||
typstDeps,
|
||||
homepage ? null,
|
||||
typstPackages,
|
||||
}:
|
||||
buildTypstPackage (finalAttrs: {
|
||||
inherit pname version;
|
||||
lib.extendMkDerivation {
|
||||
inheritFunctionArgs = false;
|
||||
constructDrv = buildTypstPackage;
|
||||
|
||||
src = fetchzip {
|
||||
inherit hash;
|
||||
url = "https://packages.typst.org/preview/${finalAttrs.pname}-${finalAttrs.version}.tar.gz";
|
||||
stripRoot = false;
|
||||
};
|
||||
excludeDrvArgNames = [
|
||||
"description"
|
||||
"hash"
|
||||
"license"
|
||||
"homepage"
|
||||
"typstDeps"
|
||||
];
|
||||
|
||||
typstDeps = builtins.filter (x: x != null) (
|
||||
lib.map (d: (lib.attrsets.attrByPath [ d ] null packages)) typstDeps
|
||||
);
|
||||
extendDrvArgs =
|
||||
finalAttrs:
|
||||
{
|
||||
pname,
|
||||
version,
|
||||
description,
|
||||
hash,
|
||||
license,
|
||||
homepage ? null,
|
||||
typstDeps ? [ ],
|
||||
}:
|
||||
{
|
||||
src = fetchzip {
|
||||
inherit hash;
|
||||
url = "https://packages.typst.org/preview/${finalAttrs.pname}-${finalAttrs.version}.tar.gz";
|
||||
stripRoot = false;
|
||||
};
|
||||
|
||||
meta = {
|
||||
inherit description;
|
||||
maintainers = with lib.maintainers; [ cherrypiejam ];
|
||||
license = lib.map (lib.flip lib.getAttr lib.licensesSpdx) license;
|
||||
}
|
||||
// (if homepage != null then { inherit homepage; } else { });
|
||||
})
|
||||
typstDeps = builtins.filter (x: x != null) (
|
||||
lib.map (d: (lib.attrsets.attrByPath [ d ] null typstPackages)) typstDeps
|
||||
);
|
||||
|
||||
meta = {
|
||||
inherit description;
|
||||
maintainers = with lib.maintainers; [
|
||||
cherrypiejam
|
||||
RossSmyth
|
||||
];
|
||||
license = lib.map (lib.flip lib.getAttr lib.licensesSpdx) license;
|
||||
}
|
||||
// lib.optionalAttrs (homepage != null) { inherit homepage; };
|
||||
};
|
||||
}
|
||||
|
||||
@@ -9,6 +9,10 @@ let
|
||||
in
|
||||
lib.makeScope newScope (
|
||||
self:
|
||||
let
|
||||
# Not public, so do not expose to the package set
|
||||
buildUniversePackage = self.callPackage ./build-universe-package.nix { typstPackages = self; };
|
||||
in
|
||||
lib.foldlAttrs (
|
||||
packageSet: pname: versionSet:
|
||||
packageSet
|
||||
@@ -16,7 +20,8 @@ lib.makeScope newScope (
|
||||
subPackageSet: version: packageSpec:
|
||||
subPackageSet
|
||||
// {
|
||||
${toPackageName pname version} = self.callPackage ./build-universe-package.nix {
|
||||
${toPackageName pname version} = buildUniversePackage {
|
||||
inherit pname version;
|
||||
inherit (packageSpec)
|
||||
hash
|
||||
description
|
||||
|
||||
Reference in New Issue
Block a user