Skip to content

Commit

Permalink
template: add .envrc to all templates
Browse files Browse the repository at this point in the history
  • Loading branch information
sandydoo committed Nov 16, 2023
1 parent c5178db commit 59f3c1e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
result
.env*
.env
.env.*
.devenv*
/.cache
/.pre-commit-config.yaml
Expand Down
11 changes: 11 additions & 0 deletions templates/flake-parts/.envrc
Original file line number Diff line number Diff line change
@@ -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

This comment has been minimized.

Copy link
@therealpxc

therealpxc Jul 10, 2024

Contributor

for the flake-parts template, shouldn't this use flake.nix and flake.lock, since devenv.lock and devenv.nix won't exist?

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
9 changes: 6 additions & 3 deletions templates/terraform/.envrc
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 59f3c1e

Please sign in to comment.