diff --git a/README.md b/README.md index 88969487..b9eb2f5a 100644 --- a/README.md +++ b/README.md @@ -4,10 +4,8 @@ * Create a new `*.nix` file in the shells directory that describes the environment (this is the hard part). -* Execute `lorri init` in the base directory of your project. This will create a `.envrc` file and `shell.nix` file. +* Execute `use_nix > .envrc` to initialize the `.envrc` file. -* Edit the `shell.nix` file so that it contains `import /path/to/this/repo/shells/your-new-file.nix`. +* Execute `ln -s /path/to/correct/file.nix shell.nix`. -* For shells that have a shellHook that exports environment containing computed directories (e.g. the git root or the current working directory), add `eval "$shellHook"` to your `.envrc`. - -* Execute `direnv allow` to load the `.envrc` file which in turn uses `lorri` to load your `shell.nix` file. +* Execute `direnv allow` to load the `.envrc` file which in turn loads your environment. diff --git a/configurations/direnv.nix b/configurations/direnv.nix index 9d2b361b..f91b9688 100644 --- a/configurations/direnv.nix +++ b/configurations/direnv.nix @@ -3,19 +3,30 @@ { custom.zfs.homeLinks = [ { path = ".local/share/direnv"; type = "cache"; } - { path = ".cache/lorri"; type = "cache"; } + { path = ".cache/direnv"; type = "cache"; } ]; + nix.extraOptions = '' + keep-outputs = true + keep-derivations = true + ''; + home-manager.users.charlotte = { ... }: { programs.direnv = { enable = true; + enableNixDirenvIntegration = true; enableZshIntegration = true; config = { global = { strict_env = true; }; }; + stdlib = '' + : ''${XDG_CACHE_HOME:=$HOME/.cache} + hash=$(echo -n $PWD | shasum | cut -d' ' -f 1) + direnv_layout_dir=$XDG_CACHE_HOME/direnv/layouts/"''$(echo -n $PWD | sed 's#/#-#g')/$hash" + mkdir -p "$direnv_layout_dir" + ''; }; - services.lorri.enable = true; }; }