From fd093465267cf0d53ebc2c710b4ac27c9ce1836f Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Thu, 12 Oct 2023 13:40:22 +0000 Subject: [PATCH 1/3] direnv: remove explicit 'shellHooks' evaluation I _think_ nix-direnv does it automatically, so no need to do it myself. --- .envrc | 2 -- 1 file changed, 2 deletions(-) diff --git a/.envrc b/.envrc index 95ed6fb..7f5642d 100644 --- a/.envrc +++ b/.envrc @@ -6,5 +6,3 @@ use flake watch_file ./flake/checks.nix watch_file ./flake/dev-shells.nix - -eval "$shellHooks" From e09899d59c8c383773e9e76bb9cd7268ca775143 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Thu, 12 Oct 2023 13:41:36 +0000 Subject: [PATCH 2/3] direnv: fix 'watch_file' directives I should use `nix_direnv_watch_file` and call it _before_ `use_flake`. --- .envrc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.envrc b/.envrc index 7f5642d..956a218 100644 --- a/.envrc +++ b/.envrc @@ -2,7 +2,7 @@ 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 -use flake +nix_direnv_watch_file ./flake/checks.nix +nix_direnv_watch_file ./flake/dev-shells.nix -watch_file ./flake/checks.nix -watch_file ./flake/dev-shells.nix +use flake From aca743dea7a76fe96c489f974b435ac2d6ab5b6c Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Thu, 12 Oct 2023 13:47:01 +0000 Subject: [PATCH 3/3] templates: simplify direnv configurations This was mostly a copy-paste error (the `watch_file` calls). As for the shell hooks, it looks like `nix-direnv` takes care of that automatically. --- templates/c++-cmake/.envrc | 5 ----- templates/c++-meson/.envrc | 5 ----- 2 files changed, 10 deletions(-) diff --git a/templates/c++-cmake/.envrc b/templates/c++-cmake/.envrc index 95ed6fb..f347aa9 100644 --- a/templates/c++-cmake/.envrc +++ b/templates/c++-cmake/.envrc @@ -3,8 +3,3 @@ if ! has nix_direnv_version || ! nix_direnv_version 2.2.1; then fi use flake - -watch_file ./flake/checks.nix -watch_file ./flake/dev-shells.nix - -eval "$shellHooks" diff --git a/templates/c++-meson/.envrc b/templates/c++-meson/.envrc index 95ed6fb..f347aa9 100644 --- a/templates/c++-meson/.envrc +++ b/templates/c++-meson/.envrc @@ -3,8 +3,3 @@ if ! has nix_direnv_version || ! nix_direnv_version 2.2.1; then fi use flake - -watch_file ./flake/checks.nix -watch_file ./flake/dev-shells.nix - -eval "$shellHooks"