nix-direnv has flake support \o/
This commit is contained in:
parent
2a76dc03ee
commit
a4279dea27
1 changed files with 6 additions and 17 deletions
|
@ -5,27 +5,16 @@
|
||||||
{ path = ".local/share/direnv"; type = "cache"; }
|
{ path = ".local/share/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;
|
||||||
enableZshIntegration = true;
|
enableZshIntegration = true;
|
||||||
config = {
|
enableNixDirenvIntegration = true;
|
||||||
global = {
|
|
||||||
strict_env = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
stdlib = ''
|
|
||||||
use_flake() {
|
|
||||||
watch_file flake.nix
|
|
||||||
watch_file flake.lock
|
|
||||||
local profile_dir="$(direnv_layout_dir)/flake-profile"
|
|
||||||
eval "$(nix print-dev-env --profile "''${profile_dir}")"
|
|
||||||
local stripped_pwd=''${PWD/\//}
|
|
||||||
local escaped_pwd=''${stripped_pwd//-/--}
|
|
||||||
local escaped_pwd=''${escaped_pwd//\//-}
|
|
||||||
ln -fs "''${profile_dir}" "/nix/var/nix/gcroots/per-user/$USER/''${escaped_pwd}"
|
|
||||||
}
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue