Skip to content
This repository has been archived by the owner on Oct 15, 2022. It is now read-only.

Do not bother user with rebuilds that don’t change the result #387

Open
nomeata opened this issue Apr 28, 2020 · 2 comments · May be fixed by #498
Open

Do not bother user with rebuilds that don’t change the result #387

nomeata opened this issue Apr 28, 2020 · 2 comments · May be fixed by #498
Labels
feature request Request for new functionality good first issue Good for newcomers

Comments

@nomeata
Copy link

nomeata commented Apr 28, 2020

I believe this is not a precise duplicate of any existing issues, but I might be wrong, in that case, sorry.

My nix-shell involes some evaluation-time computation that is easily triggered (in fact, it reads .git/index). Lorri detects that it uses that file (good), watches that file for changes (good), re-starts a build when that files changed (good), and when the build is finished, even thought the resulting derivation is identicaly, reloads my direnv (bad, because very noisy).

Maybe this is naive, but couldn’t lorri notice that the shell derivation is unchanged in most cases, and not do anything?

@Profpatsch
Copy link
Collaborator

Maybe this is naive, but couldn’t lorri notice that the shell derivation is unchanged in most cases, and not do anything?

It should, by just comparing the store path of the new gc_root with the old one, and not replacing it if it doesn’t change.

@Profpatsch
Copy link
Collaborator

The root_result call here, should be a fairly easy change:

lorri/src/build_loop.rs

Lines 187 to 195 in 200f4a2

/// Execute a single build of the environment.
///
/// This will create GC roots and expand the file watch list for
/// the evaluation.
pub fn once(&mut self) -> Result<BuildResults, BuildError> {
let run_result = builder::run(&self.project.nix_file, &self.project.cas)?;
self.register_paths(&run_result.referenced_paths)?;
self.root_result(run_result.result)
}

@Profpatsch Profpatsch added feature request Request for new functionality good first issue Good for newcomers labels May 4, 2020
leotaku added a commit to leotaku/lorri that referenced this issue Mar 11, 2021
Currently, lorri may regenerate the shell_gc_root link to the project
environments store path, even if that store path has not changed.
With this commit, lorri will now check if the current and previous
store paths are identical and, if so, avoid regenerating the symlink.

This is especially interesting as lorri instructs direnv to watch the
shell_gc_root symlink, previously causing direnv to be constantly
reinvoked for some projects.

If merged, this should also fix issue target#387.
@leotaku leotaku linked a pull request Mar 11, 2021 that will close this issue
3 tasks
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature request Request for new functionality good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants