From 3ff67be13b877517e6ee59fd02270d3a97050927 Mon Sep 17 00:00:00 2001 From: Sander Date: Thu, 16 Nov 2023 08:02:07 +0000 Subject: [PATCH 1/3] flake: add devenv-up as a package This is a quick-fix to a more complicated flake/flake-parts UX issue that needs resolving. For now this replicates what flake-parts does. Resolves #864. --- templates/simple/flake.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/templates/simple/flake.nix b/templates/simple/flake.nix index bb9fbde69..f80bed509 100644 --- a/templates/simple/flake.nix +++ b/templates/simple/flake.nix @@ -15,6 +15,10 @@ forEachSystem = nixpkgs.lib.genAttrs (import systems); in { + packages = forEachSystem (system: { + devenv-up = self.devShells.${system}.default.config.procfileScript; + }); + devShells = forEachSystem (system: let From c5178dbccdd7d8b9da3133d924028275e8c9c778 Mon Sep 17 00:00:00 2001 From: Sander Date: Thu, 16 Nov 2023 08:11:50 +0000 Subject: [PATCH 2/3] template: add .gitignore --- templates/flake-parts/.gitignore | 1 + templates/simple/.gitignore | 1 + templates/terraform/.gitignore | 1 + 3 files changed, 3 insertions(+) create mode 100644 templates/flake-parts/.gitignore create mode 100644 templates/simple/.gitignore create mode 100644 templates/terraform/.gitignore diff --git a/templates/flake-parts/.gitignore b/templates/flake-parts/.gitignore new file mode 100644 index 000000000..26d999ee5 --- /dev/null +++ b/templates/flake-parts/.gitignore @@ -0,0 +1 @@ +.devenv diff --git a/templates/simple/.gitignore b/templates/simple/.gitignore new file mode 100644 index 000000000..26d999ee5 --- /dev/null +++ b/templates/simple/.gitignore @@ -0,0 +1 @@ +.devenv diff --git a/templates/terraform/.gitignore b/templates/terraform/.gitignore new file mode 100644 index 000000000..26d999ee5 --- /dev/null +++ b/templates/terraform/.gitignore @@ -0,0 +1 @@ +.devenv From 59f3c1ecd6847c815cdc035ab06a08c331bc0b92 Mon Sep 17 00:00:00 2001 From: Sander Date: Thu, 16 Nov 2023 08:19:07 +0000 Subject: [PATCH 3/3] template: add .envrc to all templates --- .gitignore | 3 ++- templates/flake-parts/.envrc | 11 +++++++++++ templates/terraform/.envrc | 9 ++++++--- 3 files changed, 19 insertions(+), 4 deletions(-) create mode 100644 templates/flake-parts/.envrc 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