fix: Lazy load git repo and only run module if not disabled (#306)

A couple of optimizations are done in this PR. One, we now will check config ahead of time to see if a module is disabled before running any module code. Also, we won't try to discover a git repository unless the module requests access to it.
This commit is contained in:
Neil Kistner
2019-09-09 18:14:38 -05:00
committed by Matan Kushner
parent dc8409333e
commit 9f70ffb7a7
30 changed files with 111 additions and 177 deletions
+1 -1
View File
@@ -22,7 +22,7 @@ use super::{Context, Module};
/// - pure // use_name == false in a pure nix-shell
/// - impure // use_name == false in an impure nix-shell
pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> {
let mut module = context.new_module("nix_shell")?;
let mut module = context.new_module("nix_shell");
env::var("IN_NIX_SHELL")
.ok()