mirror of
https://github.com/nix-community/dream2nix.git
synced 2024-12-15 01:32:04 +03:00
fix invalidationHash logic + remove .#resolve messages
This commit is contained in:
parent
77763c957e
commit
90649d117a
@ -518,7 +518,7 @@ let
|
||||
l.pathExists "${config.projectRoot}/${project.dreamLockPath}";
|
||||
|
||||
dreamLockValid =
|
||||
project.dreamLock.lock._generic.invalidationHash or ""
|
||||
project.dreamLock._generic.invalidationHash or ""
|
||||
== project.invalidationHash;
|
||||
in
|
||||
dreamLockExists && dreamLockValid;
|
||||
@ -530,9 +530,9 @@ let
|
||||
projectsList =
|
||||
l.map
|
||||
(project: (let self = project // rec {
|
||||
dreamLock = utils.readDreamLock {
|
||||
dreamLock = (utils.readDreamLock {
|
||||
dreamLock = "${config.projectRoot}/${project.dreamLockPath}";
|
||||
};
|
||||
}).lock;
|
||||
impure = isImpure project translator;
|
||||
invalidationHash = getInvalidationHash project;
|
||||
key = getProjectKey project;
|
||||
@ -598,31 +598,18 @@ let
|
||||
l.trace ''
|
||||
${"\n"}
|
||||
Run `nix run .#resolveImpure` once to resolve impure projects.
|
||||
The following projects cannot be resolved on the fly and require preprocessing:
|
||||
The following projects cannot be resolved on the fly and are therefore excluded:
|
||||
${l.concatStringsSep "\n " projectsImpureUnresolvedInfo}
|
||||
''
|
||||
resolvedProjects
|
||||
else
|
||||
l.trace ''
|
||||
${"\n"}
|
||||
The following projects cannot be resolved on the fly and require preprocessing:
|
||||
The following projects cannot be resolved on the fly and are therefore excluded:
|
||||
${l.concatStringsSep "\n " projectsImpureUnresolvedInfo}
|
||||
''
|
||||
resolvedProjects
|
||||
else if projectsPureUnresolved != [] then
|
||||
if flakeMode then
|
||||
l.trace ''
|
||||
${"\n"}
|
||||
Evaluating project data on the fly...
|
||||
To speed up future evalutations run once:
|
||||
nix run .#resolve
|
||||
''
|
||||
resolvedProjects
|
||||
else
|
||||
l.trace ''
|
||||
${"\n"}
|
||||
Evaluating project data on the fly...
|
||||
''
|
||||
resolvedProjects
|
||||
else
|
||||
resolvedProjects;
|
||||
@ -675,6 +662,7 @@ let
|
||||
passthru = old.passthru or {} // {
|
||||
resolve = utils.makeTranslateScript {
|
||||
inherit source;
|
||||
invalidationHash = proj.invalidationHash;
|
||||
project = proj;
|
||||
};
|
||||
};
|
||||
|
@ -122,6 +122,15 @@ let
|
||||
allPkgs = makeNixpkgs pkgs systems;
|
||||
forAllSystems = f: b.mapAttrs f allPkgs;
|
||||
dream2nixFor = forAllSystems (dream2nixForSystem config);
|
||||
|
||||
getInvalidationHash = project:
|
||||
dlib.calcInvalidationHash {
|
||||
inherit source;
|
||||
# TODO: add translatorArgs
|
||||
translatorArgs = {};
|
||||
translator = project.translator;
|
||||
};
|
||||
|
||||
discoveredProjects = dlib.discoverers.discoverProjects {
|
||||
inherit settings;
|
||||
tree = dlib.prepareSourceTree { inherit source; };
|
||||
@ -148,6 +157,7 @@ let
|
||||
"Name: ${project.name}; Subsystem: ${project.subsystem}; relPath: ${project.relPath}"
|
||||
(dream2nix.utils.makeTranslateScript {
|
||||
inherit project source;
|
||||
invalidationHash = getInvalidationHash project;
|
||||
})));
|
||||
|
||||
resolveImpureScript =
|
||||
|
@ -167,6 +167,7 @@ overrideUtils
|
||||
|
||||
makeTranslateScript =
|
||||
{
|
||||
invalidationHash,
|
||||
source,
|
||||
project,
|
||||
}@args:
|
||||
@ -184,12 +185,23 @@ overrideUtils
|
||||
in
|
||||
writePureShellScriptBin "resolve"
|
||||
[
|
||||
pkgs.nix
|
||||
pkgs.coreutils
|
||||
pkgs.jq
|
||||
pkgs.gitMinimal
|
||||
pkgs.nix
|
||||
]
|
||||
''
|
||||
cd $WORKDIR
|
||||
${translator.translateBin} ${argsJsonFile}
|
||||
|
||||
# add invalidationHash to dream-lock.json
|
||||
cp ${project.dreamLockPath} ${project.dreamLockPath}.tmp
|
||||
cat ${project.dreamLockPath}.tmp \
|
||||
| jq '._generic.invalidationHash = "${invalidationHash}"' \
|
||||
> ${project.dreamLockPath}
|
||||
rm ${project.dreamLockPath}.tmp
|
||||
|
||||
# add dream-lock.json to git
|
||||
if git rev-parse --show-toplevel &>/dev/null; then
|
||||
echo "adding file to git: ${project.dreamLockPath}"
|
||||
git add ${project.dreamLockPath}
|
||||
|
Loading…
Reference in New Issue
Block a user