Use nix-direnv instead of lorri
This commit is contained in:
parent
789ffd218b
commit
32ba100ee4
2 changed files with 16 additions and 7 deletions
|
@ -4,10 +4,8 @@
|
||||||
|
|
||||||
* Create a new `*.nix` file in the shells directory that describes the environment (this is the hard part).
|
* 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 loads your environment.
|
||||||
|
|
||||||
* Execute `direnv allow` to load the `.envrc` file which in turn uses `lorri` to load your `shell.nix` file.
|
|
||||||
|
|
|
@ -3,19 +3,30 @@
|
||||||
{
|
{
|
||||||
custom.zfs.homeLinks = [
|
custom.zfs.homeLinks = [
|
||||||
{ path = ".local/share/direnv"; type = "cache"; }
|
{ 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 = { ... }: {
|
home-manager.users.charlotte = { ... }: {
|
||||||
programs.direnv = {
|
programs.direnv = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
enableNixDirenvIntegration = true;
|
||||||
enableZshIntegration = true;
|
enableZshIntegration = true;
|
||||||
config = {
|
config = {
|
||||||
global = {
|
global = {
|
||||||
strict_env = true;
|
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;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue