monogon-dev / monogon

The Monogon Monorepo. May contain traces of peanuts and a ✨pure Go Linux userland✨. Work in progress!
https://monogon.tech
Apache License 2.0
378 stars 9 forks source link

bazel wrapper: detect when nix-shell was modified #308

Open leoluk opened 3 months ago

leoluk commented 3 months ago

When updating to a later shell.nix, fail if we run bazel inside an outdated shell to avoid correctness issues.

fionera commented 3 months ago

We could evaluate the file on every run but that would evaluate the file every time and takes "forever"

 time nix-instantiate shell.nix
/nix/store/xill2lxj8ja01a735v9q0ql1bqfxl6vf-monogon-nix-shell-env.drv
nix-instantiate shell.nix  1,28s user 0,56s system 83% cpu 2,213 total
q3k commented 3 months ago

So what's the issue we're trying to solve here?

You're in a nix-shell and you want to detect that if you exited nix-shell and re-entered it you would have a different shell?

Or do you want to make Bazel aware that the environment from which you're running the bazel CLI changed significantly enough that it should restart the server within the new nix-shell?