mirror of
https://github.com/nix-community/dream2nix.git
synced 2024-09-11 14:35:30 +03:00
feat: extract homepage and description metadata in nodejs and rust
This commit is contained in:
parent
2ec675e394
commit
c621ddff9e
@ -216,9 +216,13 @@
|
||||
|
||||
inherit pname;
|
||||
|
||||
meta = {
|
||||
licenses = l.map (name: l.licenses.${name}) subsystemAttrs.licenses;
|
||||
};
|
||||
meta = let
|
||||
meta = subsystemAttrs.meta;
|
||||
in
|
||||
meta
|
||||
// {
|
||||
licenses = l.map (name: l.licenses.${name}) meta.licenses;
|
||||
};
|
||||
|
||||
passthru.dependencies = passthruDeps;
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
}: let
|
||||
b = builtins;
|
||||
l = lib // builtins;
|
||||
nodejsUtils = import ../utils.nix {inherit lib;};
|
||||
nodejsUtils = import ../utils.nix {inherit dlib lib;};
|
||||
|
||||
getPackageLock = tree: project:
|
||||
nodejsUtils.getWorkspaceLockFile tree project "package-lock.json";
|
||||
@ -172,7 +172,7 @@
|
||||
|
||||
subsystemAttrs = {
|
||||
nodejsVersion = b.toString args.nodejs;
|
||||
licenses = dlib.parseSpdxId (packageJson.license or "");
|
||||
meta = nodejsUtils.getMetaFromPackageJson packageJson;
|
||||
};
|
||||
|
||||
# functions
|
||||
|
@ -1,6 +1,17 @@
|
||||
{lib}: let
|
||||
{
|
||||
lib,
|
||||
dlib,
|
||||
}: let
|
||||
l = lib // builtins;
|
||||
in rec {
|
||||
getMetaFromPackageJson = packageJson:
|
||||
{licenses = dlib.parseSpdxId (packageJson.license or "");}
|
||||
// (
|
||||
l.filterAttrs
|
||||
(n: v: l.any (on: n == on) ["description" "homepage"])
|
||||
packageJson
|
||||
);
|
||||
|
||||
getPackageJsonDeps = packageJson: noDev:
|
||||
(packageJson.dependencies or {})
|
||||
// (lib.optionalAttrs (! noDev) (packageJson.devDependencies or {}));
|
||||
|
@ -4,7 +4,7 @@
|
||||
...
|
||||
}: let
|
||||
l = lib // builtins;
|
||||
nodejsUtils = import ../utils.nix {inherit lib;};
|
||||
nodejsUtils = import ../utils.nix {inherit dlib lib;};
|
||||
parser = import ./parser.nix {inherit lib;};
|
||||
|
||||
getYarnLock = tree: project:
|
||||
@ -142,7 +142,7 @@
|
||||
|
||||
subsystemAttrs = {
|
||||
nodejsVersion = b.toString args.nodejs;
|
||||
licenses = dlib.parseSpdxId (packageJson.license or "");
|
||||
meta = nodejsUtils.getMetaFromPackageJson packageJson;
|
||||
};
|
||||
|
||||
keys = {
|
||||
|
@ -42,6 +42,8 @@
|
||||
produceDerivation pname (buildWithToolchain defaultToolchain {
|
||||
inherit pname version src;
|
||||
|
||||
meta = utils.getMeta pname version;
|
||||
|
||||
cargoBuildFlags = cargoBuildFlags;
|
||||
cargoTestFlags = cargoBuildFlags;
|
||||
|
||||
@ -61,13 +63,6 @@
|
||||
${replacePaths}
|
||||
${utils.writeCargoLock}
|
||||
'';
|
||||
|
||||
meta = {
|
||||
licenses =
|
||||
l.map
|
||||
(name: l.licenses.${name})
|
||||
subsystemAttrs.licenses.${pname}.${version};
|
||||
};
|
||||
});
|
||||
|
||||
mkShellForPkg = pkg:
|
||||
|
@ -99,6 +99,7 @@
|
||||
buildArgs =
|
||||
common
|
||||
// {
|
||||
meta = utils.getMeta pname version;
|
||||
cargoArtifacts = deps;
|
||||
# link the vendor dir we used earlier to the correct place
|
||||
preUnpack = ''
|
||||
@ -112,12 +113,6 @@
|
||||
${utils.writeCargoLock}
|
||||
'';
|
||||
passthru = {dependencies = deps;};
|
||||
meta = {
|
||||
licenses =
|
||||
l.map
|
||||
(name: l.licenses.${name})
|
||||
subsystemAttrs.licenses.${pname}.${version};
|
||||
};
|
||||
};
|
||||
in
|
||||
produceDerivation
|
||||
|
@ -13,6 +13,14 @@
|
||||
}: let
|
||||
l = lib // builtins;
|
||||
in rec {
|
||||
getMeta = pname: version: let
|
||||
meta = subsystemAttrs.meta.${pname}.${version};
|
||||
in
|
||||
meta
|
||||
// {
|
||||
licenses = l.map (name: l.licenses.${name}) meta.licenses;
|
||||
};
|
||||
|
||||
# Gets the root source for a package
|
||||
getRootSource = pname: version: let
|
||||
root = getRoot pname version;
|
||||
|
@ -251,13 +251,20 @@ in {
|
||||
gitDeps = l.filter (dep: (getSourceTypeFrom dep) == "git") parsedDeps;
|
||||
in
|
||||
l.unique (l.map (dep: parseGitSource dep) gitDeps);
|
||||
licenses = l.foldl' l.recursiveUpdate {} (
|
||||
meta = l.foldl' l.recursiveUpdate {} (
|
||||
l.map
|
||||
(
|
||||
package: let
|
||||
pkg = package.value.package;
|
||||
licenses = dlib.parseSpdxId (pkg.license or "");
|
||||
in {${pkg.name}.${pkg.version} = licenses;}
|
||||
in {
|
||||
${pkg.name}.${pkg.version} =
|
||||
{licenses = dlib.parseSpdxId (pkg.license or "");}
|
||||
// (
|
||||
l.filterAttrs
|
||||
(n: v: l.any (on: n == on) ["description" "homepage"])
|
||||
pkg
|
||||
);
|
||||
}
|
||||
)
|
||||
cargoPackages
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user