Commit graph

170 commits

Author SHA1 Message Date
Jörg Thalheim
324ab0e942 bump version 3.0.2 2023-12-20 08:29:58 +01:00
Jörg Thalheim
04d6770ea7 set bash 4.4 as minimum 2023-12-20 08:20:11 +01:00
Arthur Noel
e079c6baa2 make version check skip less fragile 2023-12-19 19:54:28 +00:00
Arthur Noel
9d4a2cf0a6 consistently use $direnv builtin 2023-12-19 19:43:10 +00:00
Jörg Thalheim
dad4923849 bump version 3.0.1 2023-12-18 13:58:44 +01:00
Jörg Thalheim
1d3d8b61e7 don't rely on direnv to be in $PATH
fixes https://github.com/nix-community/nix-direnv/issues/446
2023-12-18 13:46:11 +01:00
Arthur Noel
add18037af make self-contained using resholve 2023-12-15 13:55:57 +00:00
Arthur Noel
4d326252ae treefmt: use shfmt and statix
simplifies treefmt.nix and adds `direnvrc` to treefmt includes for
shellcheck
2023-12-14 20:23:43 +00:00
Jörg Thalheim
4e0d1e6cf9 bump version 3.0.0 2023-12-10 22:00:37 +01:00
Jörg Thalheim
6b44093d74 deprecate nix_direnv_watch_file 2023-12-09 13:43:43 +01:00
Arthur Noel
30e02c2a10 version check: clearer language 2023-12-03 10:05:23 +00:00
Arthur Noel
31984f6083 set minimum bash version 5.2 2023-12-03 08:48:12 +00:00
Arthur Noel
04b2367f01 simplify required version checks using sort --version-sort 2023-12-03 08:47:20 +00:00
Bryan Bennett
c22289449d
Rename tmp_profile to avoid cleanup as a gcroot 2023-11-29 15:47:13 -05:00
Bryan Bennett
0c03af5544
Delay invalidating cache and gcroots until print-dev-env call succeeds
We currently eagerly invalidate the gcroots and old profile rc,
assuming that the devshell is in a usable state.
If this assumption does not hold,
we can invalidate a working state for a broken one.

Here we just delay calling _nix_clean_old_gcroots
until we know that we're in a usable state.

In the case that the flake is in an unusable state,
this simply reuses the newest working state.

This should address #412.
2023-11-29 13:58:27 -05:00
Arthur Noel
e450871ff3 idiomatic test usage 2023-11-29 13:30:44 +00:00
Arthur Noel
653f9e7217 drop _nix_direnv_realpath
its not necessary - nix-store dereferences, and its use with the path
returned by nix-instantiate does nothing
2023-11-29 13:30:44 +00:00
Arthur Noel
7f41803e52 define nix flakes command as function and consistently use it
also tidy NIX_BIN_PREFIX usage
2023-11-29 13:30:44 +00:00
Arthur Noel
d1e5ab0e02 _nix_add_gcroot: remove redundant symlink 2023-11-29 13:30:44 +00:00
Arthur Noel
57d2738ded remove doubled watches 2023-11-29 13:30:44 +00:00
Arthur Noel
a6b4125c93 bad flake expr is fatal 2023-11-29 13:30:44 +00:00
Arthur Noel
26d7044cd7 refactor logging
use functions wrapping direnv log_status and log_error
2023-11-29 13:28:03 +00:00
Jörg Thalheim
511f6554b3 bump version 2.5.1 2023-11-27 21:22:13 +01:00
Jörg Thalheim
a59d64917e do not deprecate nix_direnv_watch_file yet
we do this in 3.0.0
2023-11-27 20:19:21 +01:00
Arthur Noel
647d7feb7f _nix_direnv_watches: update path regex to match capitalized path 2023-11-26 21:06:37 +00:00
Jörg Thalheim
c84183c0ac bump version 2.5.0 2023-11-26 14:34:24 +01:00
mergify[bot]
c33cad83f8
Merge branch 'master' into no-grep 2023-11-26 13:29:01 +00:00
Jörg Thalheim
946b84daed fix crash if DIRENV_WATCHES is not set
This shouldn't happen in our current usage but better safe than sorry.
2023-11-26 14:19:24 +01:00
Jörg Thalheim
a20b32d9cd drop dependency on jq 2023-11-26 14:03:35 +01:00
Jörg Thalheim
4248f7735b use direnv show_dump to extract direnv watches 2023-11-26 13:15:37 +01:00
Jörg Thalheim
bcba9830e4 drop dependency on gnugrep 2023-11-26 12:32:12 +01:00
Arthur Noel
433948e9ad fix typos 2023-11-25 22:27:58 +00:00
Arthur Noel
6997988d1b drop nix_direnv_watch_file - instead parse DIRENV_WATCHES
fixes #408
2023-11-25 22:27:58 +00:00
Jörg Thalheim
da593f3b5e use_nix: watch for both shell.nix and default.nix
In many cases they will shell.nix will depend on default.nix and when a user switches from default.nix to shell.nix we also want to invalidate the cache.

fixes https://github.com/nix-community/nix-direnv/issues/409
2023-11-19 10:45:04 +01:00
Bryan Bennett
da6f18f71b
Quote layout_dir during script write
Co-authored-by: Jörg Thalheim <Mic92@users.noreply.github.com>
2023-11-01 09:25:35 -04:00
Bryan Bennett
4bf5d40290
Fix local flakes when prefixed with "path:"
As mentioned in #347
2023-10-31 15:04:54 -04:00
Bryan Bennett
999093c7e6
Promote Out of date cache messages to error
This provides color so that the user can see them in the possible wall
of text that direnv sometimes spits out.
2023-10-31 15:04:51 -04:00
Bryan Bennett
f452533db5
Fix nix-direnv-reload
No longer assumes location of layout directory relative to code.
2023-10-31 15:04:43 -04:00
Nils
c61fca1ed0
Update nix-direnv version in nix_direnv_version 2023-10-23 11:46:14 -07:00
Jörg Thalheim
ac9cd95422 fix _nix_direnv_force_reload not beeing bound
fixes https://github.com/nix-community/nix-direnv/issues/393
2023-10-09 13:46:55 +02:00
cydparser
fc4fdbebf1 Simplify use_flake check for flag first arguments 2023-08-07 23:51:01 -07:00
cydparser
aeade6d235 Warn when use flake receives a flag for the first argument 2023-08-07 23:50:10 -07:00
Andreas Pelme
6b5822b75b Fixes for PR review:
- Always create the nix-direnv-reload script
- Use 0/1 for booleans
- Avoid crashing when profile_rc does not exist
- Use better internal variable name for manual mode
- Make use_nix work
- Avoid unneccessary forks
- Fix shellcheck failures
- Update mtime on profile rc files to avoid confusion about if the files
  are up to date
- Add instructions to README.md
2023-07-04 19:50:31 +00:00
Andreas Pelme
1df80c4c3a Run direnv reload after nix reload. 2023-07-04 19:50:31 +00:00
Andreas Pelme
828334a1c7 Use "reload" instead of "refresh" and create a script to make the reload. 2023-07-04 19:50:31 +00:00
Andreas Pelme
406a39036f Allow manual refresh of nix environment.
Adding nix_direnv_manual_refresh to .envrc will avoid the automatic
update of the nix environment on changes and allow the user to issue a
command to update the nix environment explicitly.

Sometimes it takes a long time to rebuild the nix environment and it
happens in times. Switching branches in or rebasing can be painful since
nix will re-evaluate between nix file changes.

This blog post explains the problems with blocking the shell:
https://dev.to/allenap/some-direnv-best-practices-actually-just-one-4864

This is a first prototype, the UX can certainly be improved a bit.
2023-07-04 19:50:30 +00:00
Jörg Thalheim
2e583c8d42 bump version 2.3.0 2023-04-15 17:27:41 +02:00
Bryan Bennett
195959cda3
Merge pull request #329 from amarshall/fix-strict-env-use-nix
Fix use nix with no nixpkgs when strict_env
2023-04-14 08:32:05 -04:00
Andrew Marshall
49de6ab18f Use nix-store --add-root instead of hard-coding gcroot path
The per-user gcroot path has changed in Nix 2.14, so this is broken with
that. Regardless, this is preferable since it decouples from the Nix
implementation.
2023-04-13 21:08:29 -04:00
Andrew Marshall
9d57d29192 Do not unnecessarily remove indirect gcroot links
These are linked to the paths removed in $layout_dir. Since the links
are thus broken, Nix will take care of removing these during GC. This
avoids depending on where Nix stores gcroots in this fn (but not
everywhere in nix-direnv…yet).
2023-04-13 21:07:54 -04:00