mirror of
https://github.com/nix-community/dream2nix.git
synced 2024-12-20 13:01:44 +03:00
add flake output projectsJson
This commit is contained in:
parent
89a0c4f4c3
commit
1fc9998b0f
@ -489,6 +489,7 @@ let
|
||||
|
||||
resolveProjectsFromSource =
|
||||
{
|
||||
discoveredProjects ? dlib.discoverers.discoverProjects { inherit tree; },
|
||||
source ?
|
||||
throw "Pass either `source` or `tree` to resolveProjectsFromSource",
|
||||
tree ? dlib.prepareSourceTree { inherit source; },
|
||||
@ -498,7 +499,6 @@ let
|
||||
let
|
||||
|
||||
flakeMode = ! builtins ? currentSystem;
|
||||
discoveredProjects = dlib.discoverers.discoverProjects { inherit tree; };
|
||||
|
||||
getTranslator = subsystem: translatorName:
|
||||
translators.translatorsV2."${subsystem}".all."${translatorName}";
|
||||
|
@ -21,7 +21,7 @@ let
|
||||
let
|
||||
nodes = l.readDir path;
|
||||
packageJson = l.fromJSON (l.readFile "${path}/package.json");
|
||||
in
|
||||
translators =
|
||||
# if the package has no dependencies we use the
|
||||
# package-lock translator with `packageLock = null`
|
||||
if ! packageJson ? dependencies && ! packageJson ? devDependencies
|
||||
@ -31,6 +31,8 @@ let
|
||||
l.optionals (nodes ? "package-lock.json") [ "package-lock" ]
|
||||
++ l.optionals (nodes ? "yarn.lock") [ "yarn-lock" ]
|
||||
++ [ "package-json" ];
|
||||
in
|
||||
translators;
|
||||
|
||||
# returns the parsed package.json of a given directory
|
||||
getPackageJson = dirPath:
|
||||
|
@ -58,17 +58,9 @@ let
|
||||
|
||||
|
||||
flakifyBuilderOutputs = system: outputs:
|
||||
(lib.optionalAttrs (outputs ? "defaultPackage") {
|
||||
defaultPackage."${system}" = outputs.defaultPackage;
|
||||
})
|
||||
//
|
||||
(lib.optionalAttrs (outputs ? "packages") {
|
||||
packages."${system}" = outputs.packages;
|
||||
})
|
||||
//
|
||||
(lib.optionalAttrs (outputs ? "devShell") {
|
||||
devShell."${system}" = outputs.devShell;
|
||||
});
|
||||
l.mapAttrs
|
||||
(ouputType: outputValue: { "${system}" = outputValue; })
|
||||
outputs;
|
||||
|
||||
init =
|
||||
{
|
||||
@ -129,6 +121,9 @@ let
|
||||
allPkgs = makeNixpkgs pkgs systems;
|
||||
forAllSystems = f: b.mapAttrs f allPkgs;
|
||||
dream2nixFor = forAllSystems (dream2nixForSystem config);
|
||||
discoveredProjects = dlib.discoverers.discoverProjects {
|
||||
tree = dlib.prepareSourceTree { inherit source; };
|
||||
};
|
||||
|
||||
allBuilderOutputs =
|
||||
lib.mapAttrs
|
||||
@ -150,12 +145,16 @@ let
|
||||
(system: outputs: flakifyBuilderOutputs system outputs)
|
||||
allBuilderOutputs;
|
||||
|
||||
flakeOutputs =
|
||||
flakeOutputsBuilders =
|
||||
b.foldl'
|
||||
(allOutputs: output: lib.recursiveUpdate allOutputs output)
|
||||
{}
|
||||
flakifiedOutputsList;
|
||||
|
||||
flakeOutputs =
|
||||
{ projectsJson = l.toJSON (discoveredProjects); }
|
||||
// flakeOutputsBuilders;
|
||||
|
||||
in
|
||||
lib.recursiveUpdate
|
||||
flakeOutputs
|
||||
|
Loading…
Reference in New Issue
Block a user