diff --git a/.envrc b/.envrc --- a/.envrc +++ b/.envrc @@ -1,5 +1,12 @@ -if ! has nix_direnv_version || ! nix_direnv_version 2.2.0; then - source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.2.0/direnvrc" "sha256-5EwyKnkJNQeXrRkYbwwRBcXbibosCJqyIUuz9Xq+LRc=" -fi +# reload when these files change +watch_file flake.nix +watch_file flake.lock +watch_file nix/overlay.nix -use flake . +[[ $(type -t use_flake) == function ]] && use flake || +{ + # shell gc root dir + mkdir -p "$(direnv_layout_dir)" + + eval "$(nix print-dev-env --profile $(direnv_layout_dir)/flake-profile)" +} || use nix