lorri
lorri copied to clipboard
lorri + direnv reloads environment after every command
Describe the bug
When running a command in a directory with a lorri + direnv setup, lorri will rebuild the derivation and reload the environment, even when there were no changes to shell.nix
To Reproduce Steps to reproduce the behavior:
- Create an
.envrc
file
eval "$(lorri direnv)"
- Create a
shell.nix
with import <nixpkgs> {};
stdenv.mkDerivation {
name = "work-dev";
buildInputs = with pkgs; [
cargo clangStdenv rust-analyzer rustc rustfmt cargo-expand
openjdk gradle cmake elixir
];
}
- Run
direnv allow
❤ (tempest) ~/P/c/ooo> cd ooo/
direnv: loading ~/Projects/clients/ooo/ooo/.envrc
direnv: export +AR +AS +CC +CMAKE_INCLUDE_PATH +CMAKE_LIBRARY_PATH +CMAKE_PREFIX_PATH +CONFIG_SHELL +CXX +ERL_LIBS +HOST_PATH +IN_LORRI_SHELL +IN_NIX_SHELL +JAVA_HOME +LD +NIX_BINTOOLS +NIX_BINTOOLS_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu +NIX_BUILD_CORES +NIX_BUILD_TOP +NIX_CC +NIX_CC_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu +NIX_CFLAGS_COMPILE +NIX_ENFORCE_NO_NATIVE +NIX_HARDENING_ENABLE +NIX_INDENT_MAKE +NIX_LDFLAGS +NIX_LOG_FD +NIX_STORE +NM +OBJCOPY +OBJDUMP +RANLIB +READELF +SIZE +SOURCE_DATE_EPOCH +STRINGS +STRIP +allowSubstitutes +buildInputs +builder +configureFlags +depsBuildBuild +depsBuildBuildPropagated +depsBuildTarget +depsBuildTargetPropagated +depsHostHost +depsHostHostPropagated +depsTargetTarget +depsTargetTargetPropagated +doCheck +doInstallCheck +extraClosure +name +nativeBuildInputs +origArgs +origBuilder +origExtraClosure +origOutputs +origPATH +origSystem +out +outputs +patches +preHook +preferLocalBuild +propagatedBuildInputs +propagatedNativeBuildInputs +shell +stdenv +strictDeps +system ~PATH ~XDG_DATA_DIRS
❤ (tempest) ~/P/c/o/ooo> cat shell.nix lorri-keep-env-hack-ooo
with import <nixpkgs> {};
stdenv.mkDerivation {
name = "ooo";
buildInputs = with pkgs; [
cargo clangStdenv rust-analyzer rustc rustfmt cargo-expand
openjdk gradle cmake elixir
];
}
direnv: loading ~/Projects/clients/ooo/ooo/.envrc
direnv: export +AR +AS +CC +CMAKE_INCLUDE_PATH +CMAKE_LIBRARY_PATH +CMAKE_PREFIX_PATH +CONFIG_SHELL +CXX +ERL_LIBS +HOST_PATH +IN_LORRI_SHELL +IN_NIX_SHELL +JAVA_HOME +LD +NIX_BINTOOLS +NIX_BINTOOLS_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu +NIX_BUILD_CORES +NIX_BUILD_TOP +NIX_CC +NIX_CC_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu +NIX_CFLAGS_COMPILE +NIX_ENFORCE_NO_NATIVE +NIX_HARDENING_ENABLE +NIX_INDENT_MAKE +NIX_LDFLAGS +NIX_LOG_FD +NIX_STORE +NM +OBJCOPY +OBJDUMP +RANLIB +READELF +SIZE +SOURCE_DATE_EPOCH +STRINGS +STRIP +allowSubstitutes +buildInputs +builder +configureFlags +depsBuildBuild +depsBuildBuildPropagated +depsBuildTarget +depsBuildTargetPropagated +depsHostHost +depsHostHostPropagated +depsTargetTarget +depsTargetTargetPropagated +doCheck +doInstallCheck +extraClosure +name +nativeBuildInputs +origArgs +origBuilder +origExtraClosure +origOutputs +origPATH +origSystem +out +outputs +patches +preHook +preferLocalBuild +propagatedBuildInputs +propagatedNativeBuildInputs +shell +stdenv +strictDeps +system ~PATH ~XDG_DATA_DIRS
Expected behavior
lorri rebuilds my environment whenever a change was made to shell.nix
Metadata
$ lorri info
lorri version: 1.3
GC roots exist, shell_gc_root: "/home/.cache/lorri/gc_roots/7c3b2e96948f6bb1e93d5fb988de6702/gc_root/shell_gc_root"
$ uname -a
Linux tempest 5.4.100 #1-NixOS SMP Tue Feb 23 14:02:26 UTC 2021 x86_64 GNU/Linux
Additional context
This should be fixed on the second-to-last most recent lorri release: https://github.com/nix-community/lorri/releases/tag/1.3.1