nix-community / lorri

Your project’s nix-env [maintainer=@Profpatsch,@nyarly]
Apache License 2.0
677 stars 24 forks source link

If the first build crashes, discovered nix files are not watched #88

Open Profpatsch opened 2 years ago

Profpatsch commented 2 years ago

Describe the bug We are using a separate .toml file in our project, which gets loaded into the shell.nix (builtins.fromTOML`) where most of the packages are added.

Now if I start the lorri build loop for this project, and the first build fails, lorri will not pick up the paths from that build, meaning if I fix the issue in the .toml the lorri build will not restart.

To Reproduce Steps to reproduce the behavior:

create a shell.nix:

import ./foo.nix

create foo.nix:

let pkgs = import <nixpkgs> {};
in pkgs.mkShell {
   buildInputs = [ pkgs.this-does-not-exist ];
}

tell the lorri daemon to pick up this project (make sure it hasn’t tried to evaluate it before while runnning, otherwise restart the lorri daemon to clean its cache). Running lorri watch should also work.

Watch the build fail, then change foo.nix to

let pkgs = import <nixpkgs> {};
in pkgs.mkShell {
   buildInputs = [ pkgs.hello ];
}

Note that the build does not restart.

Expected behavior

lorri should use the info it gained even in the failing build to watch the nix files it discovered in the first run, so that when we re-run it can pick up where it failed before.

Bonus points for also working if there’s a syntax error in foo.nix.

If it’s not possible to do that, there should be a per-project option to tell lorri which set of files to watch.