diff --git a/.gitignore b/.gitignore index 52d186c15..420e5d62f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ result -.env* +.env +.env.* .devenv* /.cache /.pre-commit-config.yaml diff --git a/templates/flake-parts/.envrc b/templates/flake-parts/.envrc new file mode 100644 index 000000000..b351dff3d --- /dev/null +++ b/templates/flake-parts/.envrc @@ -0,0 +1,11 @@ +if ! has nix_direnv_version || ! nix_direnv_version 2.2.1; then + source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.2.1/direnvrc" "sha256-zelF0vLbEl5uaqrfIzbgNzJWGmLzCmYAkInj/LNxvKs=" +fi + +nix_direnv_watch_file devenv.nix +nix_direnv_watch_file devenv.lock +nix_direnv_watch_file devenv.yaml +if ! use flake . --impure +then + echo "devenv could not be built. The devenv environment was not loaded. Make the necessary changes to devenv.nix and hit enter to try again." >&2 +fi diff --git a/templates/terraform/.envrc b/templates/terraform/.envrc index 40851621d..b351dff3d 100644 --- a/templates/terraform/.envrc +++ b/templates/terraform/.envrc @@ -1,8 +1,11 @@ -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=" +if ! has nix_direnv_version || ! nix_direnv_version 2.2.1; then + source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.2.1/direnvrc" "sha256-zelF0vLbEl5uaqrfIzbgNzJWGmLzCmYAkInj/LNxvKs=" fi nix_direnv_watch_file devenv.nix nix_direnv_watch_file devenv.lock nix_direnv_watch_file devenv.yaml -use flake . --impure +if ! use flake . --impure +then + echo "devenv could not be built. The devenv environment was not loaded. Make the necessary changes to devenv.nix and hit enter to try again." >&2 +fi