mirror of
https://github.com/nix-community/dream2nix.git
synced 2024-09-11 14:35:30 +03:00
feat: allow passing project without source
This commit is contained in:
parent
62176e36d4
commit
015aef0e9f
@ -424,17 +424,18 @@ in let
|
||||
translateProjects = {
|
||||
discoveredProjects ?
|
||||
dlib.discoverers.discoverProjects
|
||||
{inherit settings tree;},
|
||||
{inherit projects settings tree;},
|
||||
projects ? {},
|
||||
source ? throw "Pass either `source` or `tree` to translateProjects",
|
||||
tree ? dlib.prepareSourceTree {inherit source;},
|
||||
pname,
|
||||
settings ? [],
|
||||
} @ args: let
|
||||
getTranslator = subsystem: translatorName:
|
||||
subsystems."${subsystem}".translators."${translatorName}";
|
||||
getTranslator = translatorName:
|
||||
framework.translatorInstances.${translatorName};
|
||||
|
||||
isImpure = project: translatorName:
|
||||
(getTranslator project.subsystem translatorName).type == "impure";
|
||||
(getTranslator translatorName).type == "impure";
|
||||
|
||||
getInvalidationHash = project:
|
||||
dlib.calcInvalidationHash {
|
||||
@ -495,7 +496,7 @@ in let
|
||||
projectsResolvedOnTheFly =
|
||||
l.forEach projectsPureUnresolved
|
||||
(proj: let
|
||||
translator = getTranslator proj.subsystem proj.translator;
|
||||
translator = getTranslator proj.translator;
|
||||
dreamLock'' = translator.translate {
|
||||
inherit source tree discoveredProjects;
|
||||
project = proj;
|
||||
@ -609,7 +610,7 @@ in let
|
||||
(
|
||||
project:
|
||||
l.nameValuePair
|
||||
"Name: ${project.name}; Subsystem: ${project.subsystem}; relPath: ${project.relPath}"
|
||||
"Name: ${project.name}; Subsystem: ${project.subsystem or "?"}; relPath: ${project.relPath}"
|
||||
(utils.makeTranslateScript {inherit project source;})
|
||||
)
|
||||
impureDiscoveredProjects
|
||||
@ -634,8 +635,12 @@ in let
|
||||
|
||||
makeOutputs = {
|
||||
source ? throw "pass a 'source' to 'makeOutputs'",
|
||||
discoveredProjects ? dlib.discoverers.discoverProjects {inherit settings source;},
|
||||
discoveredProjects ?
|
||||
dlib.discoverers.discoverProjects {
|
||||
inherit projects settings source;
|
||||
},
|
||||
pname ? null,
|
||||
projects ? {},
|
||||
settings ? [],
|
||||
packageOverrides ? {},
|
||||
sourceOverrides ? old: {},
|
||||
@ -644,7 +649,7 @@ in let
|
||||
impureDiscoveredProjects =
|
||||
l.filter
|
||||
(proj:
|
||||
subsystems."${proj.subsystem}".translators."${proj.translator}".type
|
||||
framework.translatorInstances."${proj.translator}".type
|
||||
== "impure")
|
||||
discoveredProjects;
|
||||
|
||||
|
@ -75,6 +75,7 @@
|
||||
inject ? {},
|
||||
pname ? throw "Please pass `pname` to makeFlakeOutputs",
|
||||
packageOverrides ? {},
|
||||
projects ? {},
|
||||
settings ? [],
|
||||
sourceOverrides ? oldSources: {},
|
||||
} @ args: let
|
||||
@ -92,7 +93,7 @@
|
||||
dream2nixFor = l.mapAttrs (_: pkgs: initD2N pkgs) allPkgs;
|
||||
|
||||
discoveredProjects = dlib.discoverers.discoverProjects {
|
||||
inherit settings;
|
||||
inherit projects settings;
|
||||
tree = dlib.prepareSourceTree {inherit source;};
|
||||
};
|
||||
|
||||
|
@ -65,6 +65,7 @@
|
||||
);
|
||||
|
||||
discoverProjects = {
|
||||
projects,
|
||||
source ? throw "Pass either `source` or `tree` to discoverProjects",
|
||||
tree ? dlib.prepareSourceTree {inherit source;},
|
||||
settings ? [],
|
||||
@ -78,19 +79,22 @@
|
||||
discoveredProjectsSorted = let
|
||||
sorted =
|
||||
l.sort
|
||||
(p1: p2: l.hasPrefix p1.relPath p2.relPath)
|
||||
(p1: p2: l.hasPrefix p1.relPath or "" p2.relPath or "")
|
||||
discoveredProjects;
|
||||
in
|
||||
sorted;
|
||||
|
||||
rootProject = l.head discoveredProjectsSorted;
|
||||
allProjects = discoveredProjectsSorted ++ (l.attrValues projects);
|
||||
|
||||
rootProject = l.head allProjects;
|
||||
|
||||
projectsExtended =
|
||||
l.forEach discoveredProjectsSorted
|
||||
l.forEach allProjects
|
||||
(proj:
|
||||
proj
|
||||
// {
|
||||
translator = l.head proj.translators;
|
||||
relPath = proj.relPath or "";
|
||||
translator = proj.translator or (l.head proj.translators);
|
||||
dreamLockPath = getDreamLockPath proj rootProject;
|
||||
});
|
||||
in
|
||||
@ -98,7 +102,7 @@
|
||||
|
||||
getDreamLockPath = project: rootProject:
|
||||
dlib.sanitizeRelativePath
|
||||
"${config.packagesDir}/${rootProject.name}/${project.relPath}/dream-lock.json";
|
||||
"${config.packagesDir}/${rootProject.name}/${project.relPath or ""}/dream-lock.json";
|
||||
|
||||
applyProjectSettings = projects: settingsList: let
|
||||
settingsListForProject = project:
|
||||
|
@ -188,7 +188,7 @@ in
|
||||
aggregate = project.aggregate or false;
|
||||
|
||||
translator =
|
||||
subsystems."${project.subsystem}".translators."${project.translator}";
|
||||
framework.translatorInstances."${project.translator}";
|
||||
|
||||
argsJsonFile =
|
||||
pkgs.writeText "translator-args.json"
|
||||
|
Loading…
Reference in New Issue
Block a user