mirror of
https://github.com/nix-community/dream2nix.git
synced 2024-12-24 06:52:09 +03:00
add field _generic.location
to dream-lock
This commit is contained in:
parent
6fb2ec0e6a
commit
7ff0d5d0e8
@ -204,6 +204,13 @@ class AddCommand(Command):
|
||||
# add main package source
|
||||
self.add_main_source(lock, defaultPackage, defaultPackageVersion, sourceSpec)
|
||||
|
||||
# add location
|
||||
if 'location' not in lock['_generic']:
|
||||
if 'dir' in sourceSpecSub:
|
||||
lock['_generic']['location'] = sourceSpecSub['dir']
|
||||
else:
|
||||
lock['_generic']['location'] = ''
|
||||
|
||||
# clean up dependency graph
|
||||
if 'dependencies' in lock['_generic']:
|
||||
self.postprocess_dep_graph(lock)
|
||||
@ -396,7 +403,7 @@ class AddCommand(Command):
|
||||
existingFiles = set(os.listdir(output))
|
||||
if not self.option('no-default-nix') \
|
||||
and not 'default.nix' in existingFiles \
|
||||
and not config['packagesDir']:
|
||||
and not config['projectRoot']:
|
||||
filesToCreate.append('default.nix')
|
||||
# overwrite existing files only if --force is set
|
||||
if self.option('force'):
|
||||
|
@ -575,7 +575,10 @@ let
|
||||
defaultPackageVersion =
|
||||
dreamLock._generic.packages."${defaultPackage}";
|
||||
in
|
||||
{ "${defaultPackage}"."${defaultPackageVersion}" = source; };
|
||||
{
|
||||
"${defaultPackage}"."${defaultPackageVersion}" =
|
||||
"${source}/${dreamLock._generic.location}";
|
||||
};
|
||||
|
||||
|
||||
projectOutputs =
|
||||
|
@ -155,6 +155,7 @@
|
||||
"properties": {
|
||||
"defaultPackage": { "type": ["string", "null"] },
|
||||
"invalidationHash": { "type": ["string", "null"] },
|
||||
"location": { "type": "string" },
|
||||
"packages": { "type": "object" },
|
||||
"sourcesAggregatedHash": { "type": ["string", "null"] },
|
||||
"subsystem": { "type": "string" },
|
||||
|
@ -30,11 +30,19 @@ let
|
||||
translate = args:
|
||||
l.map
|
||||
(proj:
|
||||
translator.translate
|
||||
((cleanedArgs args) // {
|
||||
source = "${args.source}/${proj.relPath}";
|
||||
name = proj.name;
|
||||
}))
|
||||
let
|
||||
dreamLock =
|
||||
translator.translate
|
||||
((cleanedArgs args) // {
|
||||
source = "${args.source}/${proj.relPath}";
|
||||
name = proj.name;
|
||||
});
|
||||
in
|
||||
dreamLock // {
|
||||
_generic = dreamLock._generic // {
|
||||
location = proj.relPath;
|
||||
};
|
||||
})
|
||||
args.projects;
|
||||
};
|
||||
in
|
||||
|
@ -88,6 +88,7 @@ let
|
||||
tree = tree.getNodeFromPath proj.relPath;
|
||||
packageLock = getPackageLock proj;
|
||||
packageJson = getPackageJson proj;
|
||||
relPath = proj.relPath;
|
||||
workspaces = proj.subsystemInfo.workspaces or [];
|
||||
})
|
||||
filteredProjects;
|
||||
@ -106,6 +107,7 @@ let
|
||||
# subsystem specific
|
||||
packageLock,
|
||||
packageJson,
|
||||
relPath,
|
||||
workspaces,
|
||||
|
||||
# translator args
|
||||
@ -222,6 +224,7 @@ let
|
||||
rec {
|
||||
|
||||
inherit translatorName;
|
||||
location = relPath;
|
||||
|
||||
# values
|
||||
inputData = pinnedRootDeps;
|
||||
|
@ -47,8 +47,9 @@ let
|
||||
magic =
|
||||
{
|
||||
# values
|
||||
inputData,
|
||||
defaultPackage,
|
||||
inputData,
|
||||
location ? "",
|
||||
mainPackageDependencies,
|
||||
packages,
|
||||
subsystemName,
|
||||
@ -239,6 +240,7 @@ let
|
||||
{
|
||||
inherit
|
||||
defaultPackage
|
||||
location
|
||||
packages
|
||||
;
|
||||
subsystem = subsystemName;
|
||||
|
Loading…
Reference in New Issue
Block a user