Skip to content

Commit f91f71b

Browse files
committed
direnv: provide example config, update Readme
The recommended direnv config is now shipped as an example file, allowing to just copy it for using. Readme is updated accordingly. The recommended NixOS config for direnv now uses the recommended nix-community use_flake hook as well.
1 parent 0f84258 commit f91f71b

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

.envrc.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
use flake . --impure --allow-dirty --no-write-lock-file
2+
build_channels_dir

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,15 @@ Automatically enter the dev shell with direnv
3939

4040
Use `direnv` to automatically enter the dev shell when you change to the fc-nixos directory.
4141

42+
A recommended direnv config is shipped in `.envrc.example` to use it in your repo checkout just
43+
`cp .envrc{.example,} && direnv allow`.
44+
45+
We recommend the usage of the [nix-community/nix-direnv](https://github.com/nix-community/nix-direnv) hook
46+
instead of the one shipped by direnv itself.
4247
To set it up with `home-manager`, see:
4348
https://github.com/nix-community/nix-direnv?tab=readme-ov-file#via-home-manager
4449

45-
Without home-manager
46-
--------------------
50+
### Without home-manager
4751

4852
On a NixOS machine, enabling `programs.direnv.enable` should be enough.
4953

@@ -54,18 +58,14 @@ Add `/etc/local/nixos/dev_vm.nix`, for example:
5458
nix.extraOptions = ''
5559
keep-outputs = true
5660
'';
57-
programs.direnv.enable = true;
61+
programs.direnv = {
62+
enable = true;
63+
nix-direnv.enable = true;
64+
};
5865
}
5966

6067
Rebuild the system, close the shell/tmux session and log in again.
6168

62-
In `fc-nixos`, add an `.envrc` file like:
63-
64-
use flake . --impure --allow-dirty
65-
build_channels_dir
66-
67-
Then, run `direnv allow` to build and enter the dev shell.
68-
6969
Run `direnv allow` again if the dev shell disappears or doesn't reload automatically.
7070

7171

0 commit comments

Comments
 (0)